{"record":{"id":"43f1024040234d91","repo":"wtfutil/wtf","slug":"failed-to-convert-username-s-to-account-id-v","errorCode":null,"errorMessage":"failed to convert username %s to account ID: %v","messagePattern":"failed to convert username (.+?) to account ID: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/jira/client.go","lineNumber":190,"sourceCode":"\n\treturn jql[start+1 : end]\n}\n\n// IssuesFor returns a collection of issues for a given collection of projects.\n// If username is provided, it scopes the issues to that person\nfunc (widget *Widget) IssuesFor(username string, projects []string, jql string) (*SearchResult, error) {\n\tquery := []string{}\n\n\tvar projQuery = getProjectQuery(projects)\n\tif projQuery != \"\" {\n\t\tquery = append(query, projQuery)\n\t}\n\n\tif username != \"\" {\n\t\t// Convert JQL with username to account ID\n\t\tconvertedJQL, err := widget.ConvertJQLWithUsername(username)\n\t\tif err != nil {\n\t\t\treturn &SearchResult{}, fmt.Errorf(\"failed to convert username %s to account ID: %v\", username, err)\n\t\t}\n\t\tquery = append(query, convertedJQL)\n\t}\n\n\tif jql != \"\" {\n\t\tquery = append(query, jql)\n\t}\n\n\t// Try the new API v3 search/jql endpoint\n\tjqlQuery := strings.Join(query, \" AND \")\n\tsearchResult, err := widget.searchWithNewAPI(jqlQuery)\n\tif err != nil {\n\t\t// If new API fails, return the error\n\t\treturn &SearchResult{}, fmt.Errorf(\"JIRA search failed: %v\", err)\n\t}\n\n\treturn searchResult, nil\n}","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/jira/client.go#L172-L208","documentation":"IssuesFor wraps any failure from ConvertJQLWithUsername in this error, tying it to the configured username. It means the JQL could not be converted from a username into an account-ID-based query, so the issue search cannot proceed and an empty SearchResult is returned to Refresh.","triggerScenarios":"IssuesFor is called with a non-empty username setting and ConvertJQLWithUsername fails for any reason: Jira API error, empty conversion result, or unparseable account ID (see errors 73-75).","commonSituations":"Wrong or deactivated username in the Jira widget config, expired Jira API token, Jira Cloud API outage or breaking change to pdcleaner, network failure to api.atlassian.com.","solutions":["Fix the underlying cause reported by the wrapped error (%v) - usually username/account resolution","Verify the username and Jira API credentials in the widget config","Test the username conversion manually against /rest/api/3/jql/pdcleaner","Remove or correct the username setting if account-based JQL is configured directly"],"exampleFix":"# before\nusername: jane (deactivated account)\n# after\nusername: jane.doe@company.com","handlingStrategy":"fallback","validationCode":"// only request username conversion when a username is actually configured\nif widget.settings.Username != \"\" && !isValidJiraUser(widget.settings.Username) {\n    return nil, fmt.Errorf(\"configure a valid Jira username before running IssuesFor\")\n}","typeGuard":null,"tryCatchPattern":"result, err := widget.IssuesFor(ctx, username, jql)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to convert username\") {\n        log.Printf(\"username conversion failed (%v); retrying without username filter\", err)\n        result, err = widget.IssuesFor(ctx, \"\", jql) // degrade to unfiltered search\n    }\n    if err != nil { return err }\n}","preventionTips":["Validate the username in Jira before putting it in widget config","Keep Jira API tokens current - conversion fails on auth errors too","Cache successful conversions and reuse them (the client caches 10m)","Monitor for this wrap message as an early signal of pdcleaner API drift"],"tags":["jira","api","go","error-wrapping"],"backgroundTag":"jira-username-conversion-failed","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}