{"record":{"id":"c00f63065e21cb64","repo":"projectdiscovery/nuclei","slug":"no-credentials-provided","errorCode":null,"errorMessage":"no credentials provided","messagePattern":"no credentials provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pdcp/writer.go","lineNumber":64,"sourceCode":"// server to enable web dashboard and more\ntype UploadWriter struct {\n\t*output.StandardWriter\n\tcreds     *pdcpauth.PDCPCredentials\n\tuploadURL *url.URL\n\tclient    *retryablehttp.Client\n\tcancel    context.CancelFunc\n\tdone      chan struct{}\n\tscanID    string\n\tscanName  string\n\tcounter   atomic.Int32\n\tTeamID    string\n\tLogger    *gologger.Logger\n}\n\n// NewUploadWriter creates a new upload writer\nfunc NewUploadWriter(ctx context.Context, logger *gologger.Logger, creds *pdcpauth.PDCPCredentials) (*UploadWriter, error) {\n\tif creds == nil {\n\t\treturn nil, fmt.Errorf(\"no credentials provided\")\n\t}\n\tu := &UploadWriter{\n\t\tcreds:  creds,\n\t\tdone:   make(chan struct{}, 1),\n\t\tTeamID: NoneTeamID,\n\t\tLogger: logger,\n\t}\n\tvar err error\n\treader, writer := io.Pipe()\n\t// create standard writer\n\tu.StandardWriter, err = output.NewWriter(\n\t\toutput.WithWriter(writer),\n\t\toutput.WithJson(true, true),\n\t)\n\tif err != nil {\n\t\treturn nil, errkit.Wrap(err, \"could not create output writer\")\n\t}\n\ttmp, err := urlutil.Parse(creds.Server)","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/internal/pdcp/writer.go#L46-L82","documentation":"NewUploadWriter (internal/pdcp/writer.go:62) builds the ProjectDiscovery Cloud (PDCP) upload pipeline and requires non-nil *pdcpauth.PDCPCredentials; nil yields 'no credentials provided'. Callers (internal/runner/runner.go:524/1039, lib/sdk_private.go:90) get creds from PDCPCredHandler.GetCreds(); reaching this error means cloud upload was enabled while the credentials object is nil — i.e. authentication was skipped or produced no creds in the programmatic path.","triggerScenarios":"Enabling cloud results upload without ever completing nuclei/PDCP authentication; SDK code calling NewUploadWriter with a nil creds value; auth token present but the credential handler returning (nil, nil) in unusual states.","commonSituations":"Fresh installs using upload flags without prior `nuclei -auth`; CI environments with no persisted credentials; SDK integrations that forget the auth step before enabling upload.","solutions":["Authenticate first (nuclei auth/PDCP login flow) so a credentials object exists","SDK users: obtain creds via pdcpauth and pass a non-nil value to NewUploadWriter","Persist the auth token in CI (secret/env) so runs find it","Turn cloud upload off if it was enabled unintentionally"],"exampleFix":"// before\nw, err := pdcp.NewUploadWriter(ctx, logger, nil)\n\n// after\nh := &pdcpauth.PDCPCredHandler{}\ncreds, err := h.GetCreds()\nif err != nil { return err }\nw, err := pdcp.NewUploadWriter(ctx, logger, creds)","handlingStrategy":"type-guard","validationCode":"h := &pdcpauth.PDCPCredHandler{}\ncreds, err := h.GetCreds()\nif err != nil || creds == nil {\n    // skip cloud upload instead of constructing the writer\n    return nil\n}","typeGuard":"func hasPDCPCredentials(c *pdcpauth.PDCPCredentials) bool {\n    return c != nil\n}","tryCatchPattern":"w, err := pdcp.NewUploadWriter(ctx, logger, creds)\nif err != nil {\n    if strings.Contains(err.Error(), \"no credentials provided\") {\n        // auth missing: run the nuclei auth flow, then retry once\n        return authenticateAndRetry()\n    }\n    return err\n}","preventionTips":["Complete nuclei/PDCP authentication before enabling cloud upload","Persist auth tokens in CI secrets so every run finds them","Guard nil creds in SDK code before calling NewUploadWriter"],"tags":["go","nuclei","pdcp","cloud-upload","authentication","nil-check"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}