earendil-works/pi · error

Failed to resolve from shell command

Error message

Failed to resolve ${description} from shell command: ${reference.config.slice(1)}

What it means

Thrown by resolveConfigValueOrThrow when a command-reference config value (prefixed with '!') resolved to undefined: the shell command produced no usable output for the described setting (API key or header).

Solutions

  1. Run the command manually and make it print the value to stdout
  2. Fix the command's exit status or output buffering
  3. Replace the command reference with a literal value or env template
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/resolve-config-value.ts:237 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/883bbe6de8182a86. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/resolve-config-value.ts:237

 * Resolve all header values using the same resolution logic as API keys.
 */
export function resolveConfigValueUncached(config: string, env?: Record<string, string>): string | undefined {
	const reference = parseConfigValueReference(config);
	if (reference.type === "command") {
		return executeCommandUncached(reference.config);
	}
	return resolveTemplate(reference.parts, env);
}

export function resolveConfigValueOrThrow(config: string, description: string, env?: Record<string, string>): string {
	const resolvedValue = resolveConfigValueUncached(config, env);
	if (resolvedValue !== undefined) {
		return resolvedValue;
	}

	const reference = parseConfigValueReference(config);
	if (reference.type === "command") {
		throw new Error(`Failed to resolve ${description} from shell command: ${reference.config.slice(1)}`);
	}

	if (reference.type === "template") {
		const missingEnvVars = getMissingConfigValueEnvVarNames(config, env);
		if (missingEnvVars.length === 1) {
			throw new Error(`Failed to resolve ${description} from environment variable: ${missingEnvVars[0]}`);
		}
		if (missingEnvVars.length > 1) {
			throw new Error(`Failed to resolve ${description} from environment variables: ${missingEnvVars.join(", ")}`);
		}
	}

	throw new Error(`Failed to resolve ${description}`);
}

/**
 * Resolve all header values using the same resolution logic as API keys.
 */

View on GitHub (pinned to 4af9d21d3b)