{"record":{"id":"efe10c90bbc1b370","repo":"wavetermdev/waveterm","slug":"ai-endpoint-is-required-efe10c","errorCode":null,"errorMessage":"ai:endpoint is required","messagePattern":"ai:endpoint is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/aiusechat/openai/openai-convertmessage.go","lineNumber":212,"sourceCode":"\n\t// If continuing from premium rate limit, downgrade to default model and medium thinking\n\t// (medium is more widely supported than low across different models)\n\tif cont != nil && cont.ContinueFromKind == uctypes.StopKindPremiumRateLimit {\n\t\topts.Model = uctypes.DefaultOpenAIModel\n\t\topts.ThinkingLevel = uctypes.ThinkingLevelMedium\n\t}\n\n\tif opts.Model == \"\" {\n\t\treturn nil, errors.New(\"ai:model is required\")\n\t}\n\tif chatOpts.ClientId == \"\" {\n\t\treturn nil, errors.New(\"chatOpts.ClientId is required\")\n\t}\n\n\t// Set defaults\n\tendpoint := opts.Endpoint\n\tif endpoint == \"\" {\n\t\treturn nil, errors.New(\"ai:endpoint is required\")\n\t}\n\n\tmaxTokens := opts.MaxTokens\n\tif maxTokens <= 0 {\n\t\tmaxTokens = OpenAIDefaultMaxTokens\n\t}\n\n\t// injected data\n\tif chatOpts.TabState != \"\" {\n\t\tappendToLastUserMessage(inputs, chatOpts.TabState)\n\t}\n\tif chatOpts.PlatformInfo != \"\" {\n\t\tappendToLastUserMessage(inputs, \"<PlatformInfo>\\n\"+chatOpts.PlatformInfo+\"\\n</PlatformInfo>\")\n\t}\n\tif chatOpts.AppStaticFiles != \"\" {\n\t\tappendToLastUserMessage(inputs, \"<CurrentAppStaticFiles>\\n\"+chatOpts.AppStaticFiles+\"\\n</CurrentAppStaticFiles>\")\n\t}\n\tif chatOpts.AppGoFile != \"\" {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/aiusechat/openai/openai-convertmessage.go#L194-L230","documentation":"buildOpenAIHTTPRequest requires a non-empty endpoint to build the OpenAI-compatible HTTP request URL. 'ai:endpoint is required' is thrown when opts.Endpoint is empty after defaults are applied; unlike some OpenAI SDKs there is no implicit fallback to api.openai.com in this code path.","triggerScenarios":"RunOpenAIChatStep is called where chatOpts.Config.Endpoint == \"\" and the premium-rate-limit continuation branch did not run (that branch sets Model/ThinkingLevel but the endpoint must still be supplied). Happens when endpoint config is missing for the OpenAI backend or opts are built manually without Endpoint.","commonSituations":"Fresh install with key and model but no endpoint; switching between OpenAI and OpenAI-compatible providers (e.g. local LLM servers) and forgetting the endpoint; config reset/migration dropping the endpoint; proxy users who removed the custom endpoint.","solutions":["Set ai:endpoint for the OpenAI backend (e.g. https://api.openai.com or your compatible server URL)","If constructing WaveChatOpts in code, assign Config.Endpoint explicitly","For OpenAI-compatible/proxy setups, confirm the endpoint URL scheme and reachability","Default to the standard OpenAI base URL at the call site when Endpoint is empty"],"exampleFix":"// before\nopts := uctypes.WaveChatOpts{Config: uctypes.WaveChatOptsConfig{Model: \"gpt-4o\", APIToken: key}}\n// after\nopts := uctypes.WaveChatOpts{Config: uctypes.WaveChatOptsConfig{Model: \"gpt-4o\", APIToken: key, Endpoint: \"https://api.openai.com\"}}","handlingStrategy":"validation","validationCode":"if chatOpts.Config.Endpoint == \"\" {\n    chatOpts.Config.Endpoint = \"https://api.openai.com\"\n}","typeGuard":null,"tryCatchPattern":"if _, _, _, err := RunOpenAIChatStep(ctx, handler, chatOpts, cont); err != nil {\n    if err.Error() == \"ai:endpoint is required\" {\n        chatOpts.Config.Endpoint = \"https://api.openai.com\"\n        return retry()\n    }\n    return err\n}","preventionTips":["Set ai:endpoint together with the model and token — treat them as a single provider profile","When using OpenAI-compatible servers or proxies, verify the endpoint URL at config time","Restore defaults after config resets so a cleared endpoint never reaches the chat step"],"tags":["openai","configuration","endpoint"],"backgroundTag":"missing-config-value","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}