can1357/oh-my-pi · error · SearchProviderError
No Codex web search model is configured.
Error message
No Codex web search model is configured.
What it means
searchCodex resolves its model list from PI_CODEX_WEB_SEARCH_MODEL or the bundled default candidates. If both are absent — meaning the defaults list is empty and nothing is configured — it throws a SearchProviderError before any network call. This is a configuration-level guard ensuring the provider never sends a request without a model id.
Source
Thrown at packages/coding-agent/src/web/search/providers/codex.ts:741
/**
* Executes a web search using OpenAI Codex's built-in web search tool.
*
* Default-model behavior:
* - If `PI_CODEX_WEB_SEARCH_MODEL` is set, use it exactly once and surface any
* upstream error verbatim.
* - Otherwise prefer ChatGPT-account-safe bundled defaults (GPT-5.6 Luna,
* Terra, Sol, GPT-5.5, …) and retry the next candidate only when Codex
* returns the known 400 "model is not supported" family. This avoids
* selecting `gpt-5-codex-mini` first on ChatGPT accounts, which OpenAI
* rejects.
*/
export async function searchCodex(params: SearchParams): Promise<SearchResponse> {
const configuredModel = getConfiguredModel();
const modelCandidates = configuredModel ? [configuredModel] : getDefaultModelCandidates();
const firstCandidate = modelCandidates[0];
if (!firstCandidate) {
throw new SearchProviderError("codex", "No Codex web search model is configured.");
}
const transport = resolveCodexSearchTransport(params.modelRegistry, firstCandidate.modelId);
// The ChatGPT-backend Codex endpoint speaks the undocumented codex-rs
// request shape (responses-lite moves tools into an `additional_tools`
// developer item), so the documented `web_search.filters.allowed_domains`
// parameter cannot be assumed to survive it. Instead, re-emit directive
// queries with the full Google-style operator syntax — the backing index
// parses the classic operator set — and leave directive-free queries
// byte-identical.
const parsed = params.parsedQuery ?? parseSearchQuery(params.query);
const query = parsed.hasDirectives ? formatQuery(parsed, GOOGLE_QUERY_SYNTAX) : params.query;
let result: CodexSearchResult;
if (transport.customEndpoint) {
// ModelRegistry resolves command-backed provider keys before consulting
// its AuthStorage, so a lower-priority OAuth origin is irrelevant when
// that command source is configured.
const credentialSource = params.modelRegistry?.authStorage ?? params.authStorage;View on GitHub (pinned to 9690622007)
Solutions
- Set PI_CODEX_WEB_SEARCH_MODEL to a valid Codex web-search-capable model id (e.g. gpt-5.6).
- Unset the empty PI_CODEX_WEB_SEARCH_MODEL variable so bundled defaults are used.
- Upgrade the package if your build is missing bundled default model candidates.
- Configure a different search provider if Codex models are unavailable to your account.
Example fix
// before export PI_CODEX_WEB_SEARCH_MODEL= # empty -> not configured // after export PI_CODEX_WEB_SEARCH_MODEL=gpt-5.6
Defensive patterns
Strategy: validation
Validate before calling
const model = getConfiguredModel();
if (!model && getDefaultModelCandidates().length === 0) {
throw new Error("Set PI_CODEX_WEB_SEARCH_MODEL to a web-search-capable model id");
} Try / catch
try {
return await searchCodex(params);
} catch (e) {
if (e instanceof SearchProviderError && e.message.includes("No Codex web search model")) {
return searchWithProvider("tavily", params);
}
throw e;
} Prevention
- Never export PI_CODEX_WEB_SEARCH_MODEL as an empty string; unset it instead to use bundled defaults.
- Pin a known-good model id in deployment config.
- Check model availability at startup rather than at first search.
When it happens
Trigger: PI_CODEX_WEB_SEARCH_MODEL is set to an empty/blank value (getConfiguredModel returns undefined) AND getDefaultModelCandidates() returns an empty array — no first candidate exists.
Common situations: Environment variable exported as empty string; a trimmed-down build or test fixture without bundled default model candidates; misreading of config precedence so users believe a model is configured when it is not.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Unsupported PI_TINY_DEVICE=${JSON.stringify(value)}. Use cpu
- Unsupported PI_TINY_DTYPE=${JSON.stringify(value)}. Use auto
- ${provider.label} web search is unavailable. Configure its c
- Unknown search provider: ${id}
- Codex request failed (${code}): ${message || "Request failed
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/456e78a339489189.
Report an issue: GitHub.