{"record":{"id":"4375ad88ad729a55","repo":"earendil-works/pi","slug":"project-is-not-trusted-refusing-to-write-project","errorCode":null,"errorMessage":"Project is not trusted; refusing to write project settings","messagePattern":"Project is not trusted; refusing to write project settings","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/core/settings-manager.ts","lineNumber":575,"sourceCode":"\t\t\t}\n\t\t\tthis.modifiedNestedFields.get(field)!.add(nestedKey);\n\t\t}\n\t}\n\n\t/** Mark a project field as modified during this session */\n\tprivate markProjectModified(field: keyof Settings, nestedKey?: string): void {\n\t\tthis.modifiedProjectFields.add(field);\n\t\tif (nestedKey) {\n\t\t\tif (!this.modifiedProjectNestedFields.has(field)) {\n\t\t\t\tthis.modifiedProjectNestedFields.set(field, new Set());\n\t\t\t}\n\t\t\tthis.modifiedProjectNestedFields.get(field)!.add(nestedKey);\n\t\t}\n\t}\n\n\tprivate assertProjectTrustedForWrite(): void {\n\t\tif (!this.projectTrusted) {\n\t\t\tthrow new Error(\"Project is not trusted; refusing to write project settings\");\n\t\t}\n\t}\n\n\tprivate recordError(scope: SettingsScope, error: unknown): void {\n\t\tthis.errors.push(toSettingsError(scope, error, this.settingsPaths[scope]));\n\t}\n\n\tprivate clearModifiedScope(scope: SettingsScope): void {\n\t\tif (scope === \"global\") {\n\t\t\tthis.modifiedFields.clear();\n\t\t\tthis.modifiedNestedFields.clear();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.modifiedProjectFields.clear();\n\t\tthis.modifiedProjectNestedFields.clear();\n\t}\n","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/core/settings-manager.ts#L557-L593","documentation":"Security guard assertProjectTrustedForWrite in SettingsManager: an attempt was made to persist a change to project-level settings, but the project directory has not been marked trusted in this session. Writes are refused so untrusted repos cannot persist settings that would execute in later sessions.","triggerScenarios":"Thrown at packages/coding-agent/src/core/settings-manager.ts:575 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Trust the project first (accept the trust prompt on startup or the trust command), then retry the settings write","Write the setting at user level instead of project level if it should apply globally"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}