{"record":{"id":"6dd03d5ddb787393","repo":"micro/go-micro","slug":"tasks-resubscribe-status-d","errorCode":null,"errorMessage":"tasks/resubscribe: status %d","messagePattern":"tasks/resubscribe: status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gateway/a2a/client.go","lineNumber":170,"sourceCode":"\t\t\t\"id\":      uuid.New().String(),\n\t\t\t\"method\":  \"tasks/resubscribe\",\n\t\t\t\"params\":  getParams{ID: taskID},\n\t\t})\n\t\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.url, bytes.NewReader(body))\n\t\tif err != nil {\n\t\t\terrs <- err\n\t\t\treturn\n\t\t}\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\treq.Header.Set(\"Accept\", \"text/event-stream\")\n\t\tresp, err := c.http.Do(req)\n\t\tif err != nil {\n\t\t\terrs <- err\n\t\t\treturn\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\terrs <- fmt.Errorf(\"tasks/resubscribe: status %d\", resp.StatusCode)\n\t\t\treturn\n\t\t}\n\t\tscanner := bufio.NewScanner(resp.Body)\n\t\tfor scanner.Scan() {\n\t\t\tline := scanner.Text()\n\t\t\tif !strings.HasPrefix(line, \"data:\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpayload := strings.TrimSpace(strings.TrimPrefix(line, \"data:\"))\n\t\t\tif payload == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar out struct {\n\t\t\t\tResult Task      `json:\"result\"`\n\t\t\t\tError  *rpcError `json:\"error\"`\n\t\t\t}\n\t\t\tif err := json.Unmarshal([]byte(payload), &out); err != nil {\n\t\t\t\terrs <- err","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/gateway/a2a/client.go#L152-L188","documentation":"The resubscribe stream method performs an HTTP POST to tasks/resubscribe and expects 200 OK before reading the SSE body. The library throws this error into the error channel when the HTTP status is not 200, meaning the server refused to reopen the event stream for the task. No events will follow; consumers should treat the stream as closed.","triggerScenarios":"Calling the resubscribe/stream method for a task ID the remote agent no longer knows (task pruned or unknown), or when the endpoint returns 401/404/5xx instead of an SSE response.","commonSituations":"Resuming after a network interruption but the agent already expired the task; wrong task ID after a reconnect; agent restarted with in-memory task state lost; auth token expired between the original subscribe and the resubscribe.","solutions":["Fall back to tasks/get (polling) to fetch the task's current state instead of resubscribing.","Verify the task ID still exists on the remote agent; if it was completed or dropped, start a new SendMessage.","Refresh auth credentials before resubscribing if the error status is 401/403.","Retry resubscribe with backoff only for 5xx/429 statuses."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"select {\ncase err := <-errs:\n\tif strings.Contains(err.Error(), \"tasks/resubscribe: status\") {\n\t\t// fall back to polling tasks/get for terminal state\n\t}\ncase ev := <-events:\n\t// handle event\n}","preventionTips":["Resubscribe promptly after disconnect before the agent expires the task","Refresh auth tokens before reconnect attempts","Verify task ID persistence on the agent before relying on resubscribe","Always implement a polling fallback for stream loss"],"tags":["network","sse","streaming","a2a"],"backgroundTag":"http-non-200-response","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}