{"record":{"id":"cc42172a4ea01fa1","repo":"earendil-works/pi","slug":"unhandled-stop-reason-exhaustive","errorCode":null,"errorMessage":"Unhandled stop reason: ${_exhaustive}","messagePattern":"Unhandled stop reason: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ai/src/api/openai-responses-shared.ts","lineNumber":789,"sourceCode":"\t\t\tif (incompleteReason === \"max_output_tokens\") {\n\t\t\t\treturn { stopReason: \"length\" };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstopReason: \"error\",\n\t\t\t\terrorMessage: incompleteReason\n\t\t\t\t\t? `Response incomplete: ${incompleteReason}`\n\t\t\t\t\t: \"Response incomplete without a provider reason\",\n\t\t\t};\n\t\tcase \"failed\":\n\t\tcase \"cancelled\":\n\t\t\treturn { stopReason: \"error\" };\n\t\t// These two are wonky ...\n\t\tcase \"in_progress\":\n\t\tcase \"queued\":\n\t\t\treturn { stopReason: \"stop\" };\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = status;\n\t\t\tthrow new Error(`Unhandled stop reason: ${_exhaustive}`);\n\t\t}\n\t}\n}\n","sourceCodeStart":771,"sourceCodeEnd":793,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/ai/src/api/openai-responses-shared.ts#L771-L793","documentation":"Error \"Unhandled stop reason: ${_exhaustive}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/ai/src/api/openai-responses-shared.ts:789 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add handling for the new stop reason in the exhaustive switch."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}