{"record":{"id":"39699869f2082e01","repo":"continuedev/continue","slug":"only-rule-files-can-be-deleted","errorCode":null,"errorMessage":"Only rule files can be deleted","messagePattern":"Only rule files can be deleted","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/core.ts","lineNumber":412,"sourceCode":"      try {\n        await createNewGlobalRuleFile(this.ide, msg.data?.baseFilename);\n        walkDirCache.invalidate();\n        await this.configHandler.reloadConfig(\n          \"Global rule created (config/addGlobalRule message)\",\n        );\n      } catch (error) {\n        throw error;\n      }\n    });\n\n    on(\"config/deleteRule\", async (msg) => {\n      try {\n        const filepath = msg.data.filepath;\n        if (\n          !isColocatedRulesFile(filepath) &&\n          !isContinueConfigRelatedUri(filepath)\n        ) {\n          throw new Error(\"Only rule files can be deleted\");\n        }\n        const fileExists = await this.ide.fileExists(filepath);\n        if (fileExists) {\n          await this.ide.removeFile(filepath);\n          walkDirCache.invalidate();\n          await this.configHandler.reloadConfig(\n            \"Rule file deleted (config/deleteRule message)\",\n          );\n        }\n      } catch (error) {\n        console.error(\"Failed to delete rule file:\", error);\n        throw error;\n      }\n    });\n\n    on(\"config/openProfile\", async (msg) => {\n      await this.configHandler.openConfigProfile(msg.data.profileId);\n    });","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/core.ts#L394-L430","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { isColocatedRulesFile, isContinueConfigRelatedUri } from 'core/index';\nif (!isColocatedRulesFile(fp) && !isContinueConfigRelatedUri(fp)) {\n  throw new Error('Refusing to delete non-rule file');\n}","typeGuard":"function isDeletablePath(fp: string): boolean {\n  return isColocatedRulesFile(fp) || isContinueConfigRelatedUri(fp);\n}","tryCatchPattern":null,"preventionTips":["Restrict frontend delete actions to recognized rules/config paths","Keep extension frontend and core versions in sync"],"tags":["file-delete","security","validation","ipc"],"backgroundTag":"operation-not-permitted","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}