earendil-works/pi · error · UnsupportedStrictJsonSchemaError

tuple schemas are unsupported

Error message

tuple schemas are unsupported

What it means

An items keyword whose value is an array (a tuple schema, position-typed elements) is unsupported in the strict subset. The converter throws rather than approximating the tuple, preserving the guarantee that the enforced grammar matches the declared schema.

Solutions

  1. Replace tuple schemas (positional items arrays) with a single item schema.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/ai/src/api/constrained-sampling.ts:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/f166657920fe47d7. Report an issue: GitHub.

Appendix: source

Thrown at packages/ai/src/api/constrained-sampling.ts:77

			throw new UnsupportedStrictJsonSchemaError(`${key} schemas are unsupported`);
		}
	}

	if (schema.anyOf !== undefined) {
		if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {
			throw new UnsupportedStrictJsonSchemaError("anyOf must contain at least one schema");
		}
		for (const variant of schema.anyOf) {
			if (isStructuredSchema(variant)) {
				throw new UnsupportedStrictJsonSchemaError("object and array unions are unsupported");
			}
			makeJsonSchemaNodeStrict(variant);
		}
	}

	if (schema.items !== undefined) {
		if (Array.isArray(schema.items)) {
			throw new UnsupportedStrictJsonSchemaError("tuple schemas are unsupported");
		}
		makeJsonSchemaNodeStrict(schema.items);
	}

	const isObjectSchema = schema.type === "object";
	if (schema.properties !== undefined && !isObjectSchema) {
		throw new UnsupportedStrictJsonSchemaError("properties require type object");
	}
	if (!isObjectSchema) return;
	if (schema.additionalProperties !== undefined && schema.additionalProperties !== false) {
		throw new UnsupportedStrictJsonSchemaError("schema-valued or true additionalProperties is unsupported");
	}
	if (schema.properties !== undefined && !isJsonSchemaObject(schema.properties)) {
		throw new UnsupportedStrictJsonSchemaError("object properties must be a schema map");
	}
	if (
		schema.required !== undefined &&
		(!Array.isArray(schema.required) || schema.required.some((key) => typeof key !== "string"))

View on GitHub (pinned to 4af9d21d3b)