{"record":{"id":"6e61c609454f3cba","repo":"projectdiscovery/nuclei","slug":"could-not-upload-results-got-status-code-v-on-v","errorCode":null,"errorMessage":"could not upload results got status code %v on %v","messagePattern":"could not upload results got status code (.+?) on (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pdcp/writer.go","lineNumber":228,"sourceCode":"\nfunc (u *UploadWriter) upload(data []byte) error {\n\treq, err := u.getRequest(data)\n\tif err != nil {\n\t\treturn errkit.Wrap(err, \"could not create upload request\")\n\t}\n\tresp, err := u.client.Do(req)\n\tif err != nil {\n\t\treturn errkit.Wrap(err, \"could not upload results\")\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tbin, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errkit.Wrap(err, \"could not get id from response\")\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"could not upload results got status code %v on %v\", resp.StatusCode, resp.Request.URL.String())\n\t}\n\tvar uploadResp uploadResponse\n\tif err := json.Unmarshal(bin, &uploadResp); err != nil {\n\t\treturn errkit.Wrap(err, fmt.Sprintf(\"could not unmarshal response got %v\", string(bin)))\n\t}\n\tif uploadResp.ID != \"\" && u.scanID == \"\" {\n\t\tu.scanID = uploadResp.ID\n\t}\n\treturn nil\n}\n\n// getRequest returns a new request for upload\n// if scanID is not provided create new scan by uploading the data\n// if scanID is provided append the data to existing scan\nfunc (u *UploadWriter) getRequest(bin []byte) (*retryablehttp.Request, error) {\n\tvar method, url string\n\n\tif u.scanID == \"\" {","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/internal/pdcp/writer.go#L210-L246","documentation":"The periodic results upload POST returned a non-200 status (internal/pdcp/writer.go:228); the error includes both the status code and the exact request URL, which distinguishes auth problems (401/403), wrong endpoints (404), rate limiting (429) and server faults (5xx). Transport-level failures surface separately as errkit-wrapped 'could not upload results', so this error specifically means the server answered with an unexpected status. The response body is read first, and a successful ID is recorded only on 200.","triggerScenarios":"Expired or invalid PDCP token (401); token lacking access to the team/scan (403); misconfigured custom API base URL (404); upstream incidents or rate limits (429/5xx) during long scans.","commonSituations":"Long-running scans whose token expires mid-run; rotated or revoked API keys; wrong -server URL; upstream service degradation.","solutions":["On 401/403 re-authenticate (nuclei auth) and verify team membership/permissions","Confirm the configured API server URL points at the intended PDCP endpoint","Treat 429/5xx as transient — uploads are periodic and usually self-heal on later ticks","Check the ProjectDiscovery cloud status for incidents"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := uploadTick(ctx)\nif err != nil {\n    msg := err.Error()\n    if strings.Contains(msg, \"status code 401\") || strings.Contains(msg, \"status code 403\") {\n        return fmt.Errorf(\"pdcp token rejected: re-authenticate\") // fail fast\n    }\n    if strings.Contains(msg, \"status code 429\") || strings.Contains(msg, \"status code 5\") {\n        backoff.RetryNotify(uploadTick, backoff.NewExponentialBackOff(), notify) // transient\n    }\n    return err\n}","preventionTips":["Refresh credentials before very long scans","Pin the correct API server URL in configuration","Treat 5xx/429 as transient; the writer uploads periodically and recovers on later ticks","Alert on repeated upload failures rather than failing the scan"],"tags":["go","nuclei","pdcp","cloud-upload","http","authentication"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}