{"record":{"id":"76bf0e93800f79dc","repo":"router-for-me/CLIProxyAPI","slug":"unsupported-codex-alpha-search-model-route-target","errorCode":null,"errorMessage":"unsupported Codex Alpha Search model route target %q (%q)","messagePattern":"unsupported Codex Alpha Search model route target %q \\(%q\\)","errorType":"http","errorClass":null,"httpStatus":503,"severity":"error","filePath":"internal/api/server_routes.go","lineNumber":237,"sourceCode":"\tmetadata := map[string]any{\n\t\tcoreexecutor.RequestedModelMetadataKey: model,\n\t}\n\tif requestPath != \"\" {\n\t\tmetadata[coreexecutor.RequestPathMetadataKey] = requestPath\n\t}\n\tresp, handled := host.RouteModel(ctx, pluginapi.ModelRouteRequest{\n\t\tSourceFormat:   codexAlphaSearchSourceFormat,\n\t\tRequestedModel: model,\n\t\tHeaders:        headers,\n\t\tQuery:          queryValues,\n\t\tBody:           body,\n\t\tMetadata:       metadata,\n\t})\n\tif !handled || !resp.Handled {\n\t\treturn model, nil\n\t}\n\tif resp.TargetKind != pluginapi.ModelRouteTargetProvider || !strings.EqualFold(strings.TrimSpace(resp.Target), \"codex\") {\n\t\treturn \"\", fmt.Errorf(\"unsupported Codex Alpha Search model route target %q (%q)\", resp.TargetKind, resp.Target)\n\t}\n\tif targetModel := strings.TrimSpace(resp.TargetModel); targetModel != \"\" {\n\t\treturn targetModel, nil\n\t}\n\treturn model, nil\n}\n\nfunc sanitizeCodexAlphaSearchBody(body []byte) []byte {\n\tvar payload map[string]json.RawMessage\n\tif errUnmarshal := json.Unmarshal(body, &payload); errUnmarshal != nil || payload == nil {\n\t\treturn body\n\t}\n\n\tremoved := false\n\tfor _, field := range []string{\"prompt_cache_key\", \"prompt_cache_retention\"} {\n\t\tif _, exists := payload[field]; exists {\n\t\t\tdelete(payload, field)\n\t\t\tremoved = true","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/api/server_routes.go#L219-L255","documentation":"Thrown while resolving the model for a Codex Alpha Search request. A plugin handled RouteModel, but the route target it returned is not a provider route pointing at the 'codex' provider. The server only accepts TargetKind == pluginapi.ModelRouteTargetProvider with Target == \"codex\" for this endpoint, so any other target kind (e.g. a model rewrite or a different provider) is rejected.","triggerScenarios":"A loaded plugin's RouteModel hook returns handled=true with TargetKind other than ModelRouteTargetProvider, or Target set to a provider name other than 'codex' (e.g. 'gemini', 'openrouter'), while a Codex Alpha Search request is being routed.","commonSituations":"Installing a third-party routing plugin that rewrites all model requests to a different provider; misconfiguring a plugin's route table so the codex alpha search path matches a cross-provider rule; plugin version change that altered TargetKind semantics.","solutions":["Update the plugin's route rules so requests sourced from Codex Alpha Search either return Target 'codex' with TargetKind ModelRouteTargetProvider, or return handled=false to let the server use the original model","Check the plugin configuration for model-route entries whose source pattern accidentally matches the alpha search endpoint","Temporarily disable the routing plugin to confirm it is the source of the redirect"],"exampleFix":"// before (plugin)\nreturn ModelRouteResponse{Handled: true, TargetKind: \"model\", Target: \"gpt-5\"}, true\n\n// after (plugin)\nreturn ModelRouteResponse{Handled: true, TargetKind: pluginapi.ModelRouteTargetProvider, Target: \"codex\", TargetModel: \"gpt-5\"}, true","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := resolveCodexAlphaSearchModel(...); err != nil && strings.Contains(err.Error(), \"unsupported Codex Alpha Search model route target\") {\n\t// plugin misroute: log target kind/target and bypass plugin routing for this request\n}","preventionTips":["Keep Codex-sourced routes out of cross-provider plugin rule patterns","Pin plugin versions and test route tables after plugin upgrades","Log TargetKind/Target on route rejection to identify the offending rule quickly"],"tags":["codex","plugin","model-routing","validation"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}