continuedev/continue · error · Error
Only rule files can be deleted
Error message
Only rule files can be deleted
What it means
The file/delete message handler in core.ts only permits deleting files that are colocated rules files or Continue config-related URIs; anything else throws 'Only rule files can be deleted'. This is a security guard preventing the extension from deleting arbitrary files.
Source
Thrown at core/core.ts:412
try {
await createNewGlobalRuleFile(this.ide, msg.data?.baseFilename);
walkDirCache.invalidate();
await this.configHandler.reloadConfig(
"Global rule created (config/addGlobalRule message)",
);
} catch (error) {
throw error;
}
});
on("config/deleteRule", async (msg) => {
try {
const filepath = msg.data.filepath;
if (
!isColocatedRulesFile(filepath) &&
!isContinueConfigRelatedUri(filepath)
) {
throw new Error("Only rule files can be deleted");
}
const fileExists = await this.ide.fileExists(filepath);
if (fileExists) {
await this.ide.removeFile(filepath);
walkDirCache.invalidate();
await this.configHandler.reloadConfig(
"Rule file deleted (config/deleteRule message)",
);
}
} catch (error) {
console.error("Failed to delete rule file:", error);
throw error;
}
});
on("config/openProfile", async (msg) => {
await this.configHandler.openConfigProfile(msg.data.profileId);
});View on GitHub (pinned to 5522c6f44c)
Solutions
- Only send delete requests for rule files under the recognized rules directories or Continue config URIs
- Update the extension/client to matching versions so path formats agree
- To delete other files, use the IDE's own file APIs, not this message channel
Defensive patterns
Strategy: validation
Validate before calling
import { isColocatedRulesFile, isContinueConfigRelatedUri } from 'core/index';
if (!isColocatedRulesFile(fp) && !isContinueConfigRelatedUri(fp)) {
throw new Error('Refusing to delete non-rule file');
} Type guard
function isDeletablePath(fp: string): boolean {
return isColocatedRulesFile(fp) || isContinueConfigRelatedUri(fp);
} Prevention
- Restrict frontend delete actions to recognized rules/config paths
- Keep extension frontend and core versions in sync
When it happens
Trigger: A frontend request to core with type 'file/delete' whose filepath is neither a colocated rules file (e.g. .continue/rules/*.md) nor a continue-config-related URI.
Common situations: Frontend code or an old client version sends deletions for arbitrary paths; a stale build sending config paths in a format the URI check no longer recognizes.
Related errors
- Table name must be in format schema.table_name, got ${tableN
- No chat model selected
- Failed to load config
- FindAndReplaceMissingOldString
- FindAndReplaceMissingNewString
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/39699869f2082e01.
Report an issue: GitHub.