earendil-works/pi · error

Tool "${tool.name}" requires JSON-schema constrained samplin

Error message

Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.

What it means

Error "Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported." thrown in earendil-works/pi.

Source

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

	return inputProperty;
}

export function resolveJsonSchemaStrictSampling(tool: Tool, supportsStrictMode: boolean): boolean | undefined {
	const config = tool.constrainedSampling;
	if (!config || config.type !== "json_schema") return undefined;

	if (supportsStrictMode) {
		try {
			makeStrictJsonSchema(tool.parameters);
			return true;
		} catch (error) {
			if (!(error instanceof UnsupportedStrictJsonSchemaError)) throw error;
			if (config.strict !== "require") return undefined;
			throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but ${error.message}.`);
		}
	}
	if (config.strict === "require") {
		throw new Error(
			`Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`,
		);
	}
	return undefined;
}

export function resolveGrammarConstrainedSampling(
	tool: Tool,
	supportsOpenAIGrammarTools: boolean,
): GrammarConstrainedSampling | undefined {
	const config = tool.constrainedSampling;
	if (!config || config.type !== "grammar") {
		return undefined;
	}

	if (!supportsOpenAIGrammarTools) {
		return undefined;
	}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Disable strict mode on the tool, or use a provider that supports strict structured outputs.

When it happens

Trigger: Thrown at packages/ai/src/api/constrained-sampling.ts:223 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/8356fcc47d9202f6. Report an issue: GitHub.