can1357/oh-my-pi · error · SearchProviderError

${provider.label} web search is unavailable. Configure its c

Error message

${provider.label} web search is unavailable. Configure its credentials or select the automatic provider chain.

What it means

executeSearch walks a chain of candidate search providers; if the caller explicitly requested a specific provider (candidate.explicit) but that provider reports it is not explicitly available (no credentials configured in AuthStorage), it throws SearchProviderError with this message. Automatic-chain candidates are simply skipped; explicit ones fail hard.

Source

Thrown at packages/coding-agent/src/web/search/index.ts:197

	} catch {
		// Preserve the default for one-shot callers that do not initialize Settings.
	}

	const failures: Array<{ provider: Pick<SearchProvider, "id" | "label">; error: unknown }> = [];
	let availableProviderCount = 0;
	let lastProvider: Pick<SearchProvider, "id" | "label"> | undefined;
	for (const candidate of candidates) {
		let provider: SearchProvider | undefined;
		const providerMeta = { id: candidate.id, label: getSearchProviderLabel(candidate.id) };
		lastProvider = providerMeta;
		try {
			provider = await getSearchProvider(candidate.id);
			const available = candidate.explicit
				? await provider.isExplicitlyAvailable(authStorage)
				: await provider.isAvailable(authStorage);
			if (!available && !candidate.explicit) continue;
			if (!available && candidate.explicit) {
				throw new SearchProviderError(
					provider.id,
					`${provider.label} web search is unavailable. Configure its credentials or select the automatic provider chain.`,
				);
			}
			availableProviderCount++;
			lastProvider = provider;

			const response = await provider.search({
				query: params.query,
				parsedQuery,
				limit: params.limit,
				recency: params.recency,
				systemPrompt: webSearchSystemPrompt,
				maxOutputTokens: params.max_tokens,
				numSearchResults: params.num_search_results,
				temperature: params.temperature,
				signal,
				timeoutMs,

View on GitHub (pinned to 9690622007)

Solutions

  1. Configure credentials for the requested provider (set its API key via auth storage / onboarding).
  2. Switch to the automatic provider chain (omit the explicit provider id) so available providers are picked automatically.
  3. Verify with provider.isAvailable()/isExplicitlyAvailable(authStorage) before requesting an explicit provider.
  4. Check env vars/config for the provider (e.g. ANTHROPIC_API_KEY, BRAVE_API_KEY) are set in the environment the agent runs in.

Example fix

// before
await runSearchQuery(params, { authStorage }); // explicit provider 'brave' with no key
// after
const brave = await getSearchProvider("brave");
if (await brave.isExplicitlyAvailable(authStorage)) {
  await runSearchQuery({ ...params, provider: "brave" }, { authStorage });
} else {
  await runSearchQuery(params, { authStorage }); // automatic chain
}
Defensive patterns

Strategy: fallback

Validate before calling

const provider = await getSearchProvider(id);
if (!(await provider.isExplicitlyAvailable(authStorage))) {
  throw new Error(`${provider.label} not configured — falling back to automatic chain`);
}

Type guard

null

Try / catch

try {
  return await runSearchQuery({ ...params, provider: explicitId }, opts);
} catch (e) {
  if (e instanceof SearchProviderError && /unavailable/.test(e.message)) {
    return await runSearchQuery(params, opts); // automatic chain
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling runSearchQuery/execute with an explicit provider id (e.g. 'anthropic' or 'brave') whose API key/credentials are missing from auth storage.

Common situations: Config file or CLI flag pins a search provider that was never configured; API key removed or rotated out of the auth storage; fresh install without provider setup.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/c5c7183993e65b3e. Report an issue: GitHub.