{"record":{"id":"b2c23ba20a3c0437","repo":"earendil-works/pi","slug":"boolean-schemas-are-unsupported","errorCode":null,"errorMessage":"boolean schemas are unsupported","messagePattern":"boolean schemas are unsupported","errorType":"exception","errorClass":"UnsupportedStrictJsonSchemaError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/api/constrained-sampling.ts","lineNumber":55,"sourceCode":"\tconst types = typeof schema.type === \"string\" ? [schema.type] : Array.isArray(schema.type) ? schema.type : [];\n\treturn (\n\t\ttypes.includes(\"object\") ||\n\t\ttypes.includes(\"array\") ||\n\t\tschema.properties !== undefined ||\n\t\tschema.items !== undefined\n\t);\n}\n\nfunction schemaAllowsNull(schema: unknown): boolean {\n\tif (!isJsonSchemaObject(schema)) return false;\n\tif (schema.type === \"null\" || (Array.isArray(schema.type) && schema.type.includes(\"null\"))) return true;\n\tif (schema.const === null || (Array.isArray(schema.enum) && schema.enum.includes(null))) return true;\n\treturn Array.isArray(schema.anyOf) && schema.anyOf.some((variant) => schemaAllowsNull(variant));\n}\n\nfunction makeJsonSchemaNodeStrict(schema: unknown): void {\n\tif (!isJsonSchemaObject(schema)) {\n\t\tthrow new UnsupportedStrictJsonSchemaError(\"boolean schemas are unsupported\");\n\t}\n\tfor (const key of UNSUPPORTED_STRICT_SCHEMA_KEYS) {\n\t\tif (schema[key] !== undefined) {\n\t\t\tthrow new UnsupportedStrictJsonSchemaError(`${key} schemas are unsupported`);\n\t\t}\n\t}\n\n\tif (schema.anyOf !== undefined) {\n\t\tif (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {\n\t\t\tthrow new UnsupportedStrictJsonSchemaError(\"anyOf must contain at least one schema\");\n\t\t}\n\t\tfor (const variant of schema.anyOf) {\n\t\t\tif (isStructuredSchema(variant)) {\n\t\t\t\tthrow new UnsupportedStrictJsonSchemaError(\"object and array unions are unsupported\");\n\t\t\t}\n\t\t\tmakeJsonSchemaNodeStrict(variant);\n\t\t}\n\t}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/ai/src/api/constrained-sampling.ts#L37-L73","documentation":"Error \"boolean schemas are unsupported\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/ai/src/api/constrained-sampling.ts:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace boolean JSON schemas with equivalent object schemas or omit them."],"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"}