{"record":{"id":"d1ff531e50e79811","repo":"micro/go-micro","slug":"video-completed-but-no-outputs-returned","errorCode":null,"errorMessage":"video completed but no outputs returned","messagePattern":"video completed but no outputs returned","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ai/atlascloud/atlascloud.go","lineNumber":1168,"sourceCode":"\tdefer httpResp.Body.Close()\n\n\tbody, _ := io.ReadAll(httpResp.Body)\n\n\tvar pollResp struct {\n\t\tData struct {\n\t\t\tStatus  string   `json:\"status\"`\n\t\t\tOutputs []string `json:\"outputs\"`\n\t\t\tError   string   `json:\"error\"`\n\t\t} `json:\"data\"`\n\t}\n\tif err := json.Unmarshal(body, &pollResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse poll response: %w\", err)\n\t}\n\n\tswitch pollResp.Data.Status {\n\tcase \"completed\", \"succeeded\":\n\t\tif len(pollResp.Data.Outputs) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"video completed but no outputs returned\")\n\t\t}\n\t\treturn &ai.VideoResponse{URL: pollResp.Data.Outputs[0]}, nil\n\tcase \"failed\":\n\t\treturn nil, fmt.Errorf(\"video generation failed: %s\", pollResp.Data.Error)\n\tdefault:\n\t\treturn nil, nil\n\t}\n}\n","sourceCodeStart":1150,"sourceCodeEnd":1177,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/ai/atlascloud/atlascloud.go#L1150-L1177","documentation":"AtlasCloud's video polling loop detected a terminal 'completed'/'succeeded' status, but the poll response's Outputs array was empty, so there is no video URL to return. The library treats an empty outputs list on a successful status as an inconsistent API response rather than silently returning an empty result. This surfaces from the video generation polling path after the job finished.","triggerScenarios":"Polling an AtlasCloud video generation job whose status became 'completed' or 'succeeded' while pollResp.Data.Outputs contained zero entries.","commonSituations":"Provider-side retention issues where the output URL expired or was purged before polling; API contract changes to the outputs field name; model variants that deliver results via a different field; transient backend glitches after job completion.","solutions":["Retry the whole generation job; this is usually a provider-side data inconsistency, not a client bug.","Log the full pollResp.Data payload (add temporary debugging or check API docs) to see if outputs moved to another field.","Check the AtlasCloud API changelog for changes to the poll response schema or outputs field.","Add a short re-poll with backoff before failing, in case outputs populate shortly after the status flips to completed."],"exampleFix":"// before\nif len(pollResp.Data.Outputs) == 0 {\n    return nil, fmt.Errorf(\"video completed but no outputs returned\")\n}\n// after\nif len(pollResp.Data.Outputs) == 0 {\n    // optionally re-poll once before giving up\n    return nil, fmt.Errorf(\"video completed but no outputs returned (status=%s, job=%s)\", pollResp.Data.Status, jobID)\n}","handlingStrategy":"validation","validationCode":"if len(resp.Outputs()) == 0 && resp.Status() == \"completed\" {\n    // treat as provider inconsistency; re-run or alert before using the result\n}","typeGuard":"func hasVideoURL(r *ai.VideoResponse) bool { return r != nil && r.URL != \"\" }","tryCatchPattern":"video, err := provider.GenerateVideo(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"video completed but no outputs returned\") {\n        video, err = provider.GenerateVideo(ctx, req) // one retry\n    }\n    if err != nil { return err }\n}","preventionTips":["Always nil-check/URL-check the VideoResponse before use","Poll with a small grace period after 'completed' status before reading outputs","Log the raw poll response for provider support escalation","Track AtlasCloud API changelog for response schema changes"],"tags":["video-generation","api-response","atlascloud","empty-response"],"backgroundTag":"empty-api-response-outputs","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}