continuedev/continue · error · ContinueError
Reading or Editing ${filepath} is not allowed because it is
Error message
Reading or Editing ${filepath} is not allowed because it is a security concern. Do not attempt to read or edit this file in any way. What it means
Thrown by throwIfFileIsSecurityConcern before any read or edit of a file matching default security ignore patterns (e.g. .env, credentials, keys). The library hard-blocks access to sensitive files regardless of user intent, and the message tells the model never to retry them.
Source
Thrown at core/indexing/ignore.ts:259
}
let filepath = filePathOrUri;
try {
filepath = fileURLToPath(filePathOrUri);
} catch {}
if (path.isAbsolute(filepath)) {
const dir = path.dirname(filepath).split(/\/|\\/).at(-1) ?? "";
const basename = path.basename(filepath);
filepath = `${dir ? dir + "/" : ""}${basename}`;
}
if (!filepath) {
return false;
}
return defaultFileAndFolderSecurityIgnores.ignores(filepath);
}
export function throwIfFileIsSecurityConcern(filepath: string) {
if (isSecurityConcern(filepath)) {
throw new ContinueError(
ContinueErrorReason.FileIsSecurityConcern,
`Reading or Editing ${filepath} is not allowed because it is a security concern. Do not attempt to read or edit this file in any way.`,
);
}
}
export function gitIgArrayFromFile(file: string) {
return file
.split(/\r?\n/) // Split on new line
.map((l) => l.trim()) // Remove whitespace
.filter((l) => !/^#|^$/.test(l)); // Remove empty lines
}
View on GitHub (pinned to 5522c6f44c)
Solutions
- Do not read or edit the flagged file; work with a sanitized example (e.g. .env.example) instead
- Move secrets out of the blocked file and into your secret manager, then edit the non-secret config
- If you truly must inspect it, do so manually outside the tooling — do not attempt to bypass the guard
Example fix
// before
await readFile({ filepath: ".env" });
// after
await readFile({ filepath: ".env.example" }); Defensive patterns
Strategy: validation
Validate before calling
const SENSITIVE = [/\.env/, /id_rsa/, /(credential|secret|token)s?/i]; if (SENSITIVE.some(r => r.test(filepath))) throw new Error('refusing sensitive file'); Type guard
const isSafePath = (fp: string) => !/(^|\/)\.(env|ssh|aws|gnupg)|secret|credential|private.*key/i.test(fp);
Try / catch
catch (e) { if (e.message.includes('security concern')) { useExampleFileInstead(); } else throw e; } Prevention
- Never point tools at .env or key files
- Edit .example templates instead
- Keep secrets in a manager, not files agents can reach
When it happens
Trigger: Any read/edit tool call whose resolved path matches the built-in security ignore list: .env files, SSH keys, token/credential files, and similar sensitive artifacts.
Common situations: LLM agents attempting to 'fix config' by editing .env; automated refactors that glob over a repo and hit dotfiles/credential files; users trying to read secrets to debug environment issues.
Related errors
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/8344a4dfefaea602.
Report an issue: GitHub.