{"record":{"id":"a07a23f06a0f9a7b","repo":"Fission-AI/OpenSpec","slug":"invalid-context-field-in-config-must-be-string","errorCode":null,"errorMessage":"Invalid 'context' field in config (must be string)","messagePattern":"Invalid 'context' field in config \\(must be string\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/project-config.ts","lineNumber":309,"sourceCode":"    }\n\n    // Parse context field with size limit\n    if (raw.context !== undefined) {\n      const contextField = z.string();\n      const contextResult = contextField.safeParse(raw.context);\n\n      if (contextResult.success) {\n        const contextSize = Buffer.byteLength(contextResult.data, 'utf-8');\n        if (contextSize > MAX_CONTEXT_SIZE) {\n          console.warn(\n            `Context too large (${(contextSize / 1024).toFixed(1)}KB, limit: ${MAX_CONTEXT_SIZE / 1024}KB)`\n          );\n          console.warn(`Ignoring context field`);\n        } else {\n          config.context = contextResult.data;\n        }\n      } else {\n        console.warn(`Invalid 'context' field in config (must be string)`);\n      }\n    }\n\n    // Parse rules field using Zod\n    if (raw.rules !== undefined) {\n      const rulesField = z.record(z.string(), z.array(z.string()));\n\n      // First check if it's an object structure (guard against null since typeof null === 'object')\n      if (typeof raw.rules === 'object' && raw.rules !== null && !Array.isArray(raw.rules)) {\n        // Artifact ids are intentionally not restricted to the built-in naming\n        // convention, so keys such as \"constructor\" remain valid for custom\n        // schemas. A null-prototype map preserves those keys as data without\n        // letting \"__proto__\" mutate the lookup object's prototype.\n        const parsedRules: Record<string, string[]> = Object.create(null);\n        let hasValidRules = false;\n\n        for (const [artifactId, rules] of Object.entries(raw.rules)) {\n          const rulesArrayResult = z.array(z.string()).safeParse(rules);","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/project-config.ts#L291-L327","documentation":"Error \"Invalid 'context' field in config (must be string)\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/project-config.ts:309 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}