{"record":{"id":"bb1b3470a5b8cd3d","repo":"Yeachan-Heo/oh-my-codex","slug":"refusing-malformed-field-in-entrypath","errorCode":null,"errorMessage":"Refusing malformed ${field} in ${entryPath}.","messagePattern":"Refusing malformed (.+?) in (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":8340,"sourceCode":"  authority: ExactSessionCancellationAuthority,\n  path: string,\n): void {\n  if (!Object.prototype.hasOwnProperty.call(value, \"active_skills\")) return;\n  if (!Array.isArray(value.active_skills)) {\n    throw new Error(`Refusing malformed active_skills in ${path}.`);\n  }\n  for (const [index, skill] of value.active_skills.entries()) {\n    const entryPath = `${path} active_skills[${index}]`;\n    if (!skill || typeof skill !== \"object\" || Array.isArray(skill)) {\n      throw new Error(`Refusing malformed active_skills entry ${index} in ${path}.`);\n    }\n    const entry = skill as Record<string, unknown>;\n    if (typeof entry.skill !== \"string\" || entry.skill.trim() === \"\") {\n      throw new Error(`Refusing malformed skill in ${entryPath}.`);\n    }\n    for (const field of [\"active\"] as const) {\n      if (Object.prototype.hasOwnProperty.call(entry, field) && typeof entry[field] !== \"boolean\") {\n        throw new Error(`Refusing malformed ${field} in ${entryPath}.`);\n      }\n    }\n    if (Object.prototype.hasOwnProperty.call(entry, \"phase\") && typeof entry.phase !== \"string\") {\n      throw new Error(`Refusing malformed phase in ${entryPath}.`);\n    }\n    for (const [field, fieldValue] of Object.entries(entry)) {\n      if (field.endsWith(\"_at\") && typeof fieldValue !== \"string\") {\n        throw new Error(`Refusing malformed ${field} in ${entryPath}.`);\n      }\n    }\n    assertExactSkillOwner(entry, authority, entryPath);\n  }\n}\n\ninterface CancellationTestFaults {\n  writeFailureMode?: string;\n  rollbackFailureMode?: string;\n}","sourceCodeStart":8322,"sourceCodeEnd":8358,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L8322-L8358","documentation":"When an active_skills entry includes an active field, it must be a boolean. This error is thrown if active is present but has any other type (string \"true\", number 1, null). The strictness prevents truthy/falsy coercion bugs when cancellation logic toggles skill activation.","triggerScenarios":"A state entry like {\"skill\": \"x\", \"active\": \"true\"} or {\"skill\": \"x\", \"active\": 1}; the hasOwnProperty check passes but the typeof check fails, so cancel throws immediately.","commonSituations":"YAML-to-JSON conversion tools that stringify booleans; hand-edited state; other runtimes or serializers emitting 0/1 for booleans.","solutions":["Find the entry in the state file and change active to a JSON boolean true or false","Remove the active field if the default behavior is acceptable","Retry the cancel command","Keep booleans unquoted when editing state JSON by hand"],"exampleFix":"// before\n{ \"skill\": \"x\", \"active\": \"true\" }\n// after\n{ \"skill\": \"x\", \"active\": true }","handlingStrategy":"type-guard","validationCode":"function activeFlagsValid(entries: Record<string, unknown>[]): boolean {\n  return entries.every((e) => !Object.prototype.hasOwnProperty.call(e, \"active\") || typeof e.active === \"boolean\");\n}","typeGuard":"function isStrictBoolean(v: unknown): v is boolean {\n  return typeof v === \"boolean\";\n}","tryCatchPattern":null,"preventionTips":["Use JSON booleans, never quoted \"true\"/\"false\"","When converting from YAML/config formats, coerce booleans explicitly"],"tags":["state-validation","cli","type-mismatch","cancel"],"backgroundTag":"schema-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}