{"record":{"id":"a4a2090064c51b71","repo":"micro/go-micro","slug":"no-response-from-api-a4a209","errorCode":null,"errorMessage":"no response from API","messagePattern":"no response from API","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ai/together/together.go","lineNumber":203,"sourceCode":"\t\tChoices []struct {\n\t\t\tMessage struct {\n\t\t\t\tContent   string `json:\"content\"`\n\t\t\t\tToolCalls []struct {\n\t\t\t\t\tID       string `json:\"id\"`\n\t\t\t\t\tFunction struct {\n\t\t\t\t\t\tName      string `json:\"name\"`\n\t\t\t\t\t\tArguments string `json:\"arguments\"`\n\t\t\t\t\t} `json:\"function\"`\n\t\t\t\t} `json:\"tool_calls\"`\n\t\t\t} `json:\"message\"`\n\t\t} `json:\"choices\"`\n\t}\n\n\tif err := json.Unmarshal(respBody, &chatResp); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to parse response: %w\", err)\n\t}\n\tif len(chatResp.Choices) == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"no response from API\")\n\t}\n\n\tchoice := chatResp.Choices[0]\n\tresponse := &ai.Response{Reply: choice.Message.Content}\n\n\tfor _, tc := range choice.Message.ToolCalls {\n\t\tvar input map[string]any\n\t\tif err := json.Unmarshal([]byte(tc.Function.Arguments), &input); err != nil {\n\t\t\tinput = map[string]any{}\n\t\t}\n\t\tresponse.ToolCalls = append(response.ToolCalls, ai.ToolCall{\n\t\t\tID:    tc.ID,\n\t\t\tName:  tc.Function.Name,\n\t\t\tInput: input,\n\t\t})\n\t}\n\n\trawMessage := map[string]any{","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/ai/together/together.go#L185-L221","documentation":"The Together API returned HTTP 200 with valid JSON but an empty choices array, so there is no message to extract. The library treats this as an error because a chat completion should always contain at least one choice.","triggerScenarios":"A 200 response whose body is {\"choices\":[]} — e.g. the model produced no output, an unusual finish configuration, or a gateway echoing an empty success.","commonSituations":"Content-filtered or empty completions, misconfigured model names on compatible gateways, buggy self-hosted proxies returning empty successful responses.","solutions":["Log the raw respBody to confirm choices is empty vs malformed","Verify the model name in the request is valid for the endpoint","Retry the request — empty completions are often transient","If using a gateway/proxy, test the same request directly against api.together.xyz"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"resp, err := p.Generate(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"no response from API\") {\n        // inspect raw body/logs, then retry once\n    }\n}","preventionTips":["Validate model names before calls","Retry transient empty completions","Alert on repeated empty responses (gateway misbehavior)","Test against api.together.xyz directly when using gateways"],"tags":["ai-provider","together","empty-response"],"backgroundTag":"empty-api-response","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}