> For the complete documentation index, see [llms.txt](https://docs.patchmypc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.patchmypc.com/patch-my-pc-cloud/troubleshoot/deployments/typeerror-failed-to-fetch-error-when-trying-to-upload-a-pre-or-post-script-in-cloud.md).

# "TypeError: Failed to fetch" error when trying to upload  a Pre or Post Script in Cloud

*Applies to: Patch My PC Cloud*

### SYMPTOMS

I am trying to upload a Pre (or Post) script, but I get the following error:

**Error - TypeError: Failed to fetch**

<figure><img src="/files/SjEuWbmp52c641R9Z3hH" alt="Error - TypeError: Failed to fetch" width="350"><figcaption></figcaption></figure>

### CAUSE

This error can happen if your pre/post script contains either of the following variables:

`"${env:ProgramFiles(x86)}"`

`"${env:ProgramFiles}"`

This issue is not caused by the Patch My PC (PMPC) Cloud portal but by Cloudflare, who are incorrectly identifying them as a false-positive and blocking the upload as they think the script is a Log4j exploit.

### RESOLUTION

As Cloudflare is causing this issue, we cannot implement a fix. We are actively working with them to try to resolve this false positive.

In the meantime, to work around this issue, use the following replacements in your affected scripts:

<table><thead><tr><th valign="top">Replace all instances of…</th><th valign="top">With...</th></tr></thead><tbody><tr><td valign="top"><code>"${env:ProgramFiles(x86)}"</code></td><td valign="top"><code>"$($env:SystemDrive)\Program Files (x86)"</code></td></tr><tr><td valign="top"><code>"${env:ProgramFiles}"</code></td><td valign="top"><code>"$($env:SystemDrive)\Program Files"</code></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.patchmypc.com/patch-my-pc-cloud/troubleshoot/deployments/typeerror-failed-to-fetch-error-when-trying-to-upload-a-pre-or-post-script-in-cloud.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
