earendil-works/pi · error

Provider : must specify "baseUrl", "headers", "compat"…

Error message

Provider ${providerId}: must specify "baseUrl", "headers", "compat", "modelOverrides", or "models".

What it means

Validation in applyModelsJson: the provider's config block contains none of the meaningful keys (baseUrl, headers, compat, modelOverrides, models, apiKey, oauth, authHeader), indicating a likely misconfiguration — an empty or keyless provider entry that would silently do nothing.

Solutions

  1. Add at least one of the recognized keys to the provider block in models.json
  2. Remove the provider entry if it is not needed
  3. Fix key typos (e.g. baseurl instead of baseUrl)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/provider-composer.ts:188 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/b78e3655bc6899d5. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/provider-composer.ts:188

	baseModels: readonly Model<Api>[],
	config: ModelsJsonProvider | undefined,
): Model<Api>[] {
	if (!config) return [...baseModels];
	if (config.oauth && !config.baseUrl) {
		throw new Error(`Provider ${providerId}: "baseUrl" is required when "oauth" is set.`);
	}
	const hasOverrides = config.modelOverrides && Object.keys(config.modelOverrides).length > 0;
	if (
		!config.models?.length &&
		!config.baseUrl &&
		!config.headers &&
		!config.compat &&
		!hasOverrides &&
		!config.apiKey &&
		!config.oauth &&
		config.authHeader === undefined
	) {
		throw new Error(
			`Provider ${providerId}: must specify "baseUrl", "headers", "compat", "modelOverrides", or "models".`,
		);
	}

	const models: Model<Api>[] = baseModels.map((model) => ({
		...model,
		baseUrl: config.oauth === "radius" ? model.baseUrl : (config.baseUrl ?? model.baseUrl),
		compat: mergeCompat(model.compat, config.compat),
	}));
	for (const definition of config.models ?? []) {
		const existingIndex = models.findIndex((model) => model.id === definition.id);
		const defaults = existingIndex >= 0 ? models[existingIndex] : models[0];
		const model = modelFromJson(providerId, definition, config, defaults);
		if (existingIndex >= 0) models[existingIndex] = model;
		else models.push(model);
	}
	return models;
}

View on GitHub (pinned to 4af9d21d3b)