wtfutil/wtf · error

failed to convert username %s to account ID: %v

Error message

failed to convert username %s to account ID: %v

What it means

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.

Source

Thrown at modules/jira/client.go:190

	return jql[start+1 : end]
}

// IssuesFor returns a collection of issues for a given collection of projects.
// If username is provided, it scopes the issues to that person
func (widget *Widget) IssuesFor(username string, projects []string, jql string) (*SearchResult, error) {
	query := []string{}

	var projQuery = getProjectQuery(projects)
	if projQuery != "" {
		query = append(query, projQuery)
	}

	if username != "" {
		// Convert JQL with username to account ID
		convertedJQL, err := widget.ConvertJQLWithUsername(username)
		if err != nil {
			return &SearchResult{}, fmt.Errorf("failed to convert username %s to account ID: %v", username, err)
		}
		query = append(query, convertedJQL)
	}

	if jql != "" {
		query = append(query, jql)
	}

	// Try the new API v3 search/jql endpoint
	jqlQuery := strings.Join(query, " AND ")
	searchResult, err := widget.searchWithNewAPI(jqlQuery)
	if err != nil {
		// If new API fails, return the error
		return &SearchResult{}, fmt.Errorf("JIRA search failed: %v", err)
	}

	return searchResult, nil
}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Fix the underlying cause reported by the wrapped error (%v) - usually username/account resolution
  2. Verify the username and Jira API credentials in the widget config
  3. Test the username conversion manually against /rest/api/3/jql/pdcleaner
  4. Remove or correct the username setting if account-based JQL is configured directly

Example fix

# before
username: jane (deactivated account)
# after
username: jane.doe@company.com
Defensive patterns

Strategy: fallback

Validate before calling

// only request username conversion when a username is actually configured
if widget.settings.Username != "" && !isValidJiraUser(widget.settings.Username) {
    return nil, fmt.Errorf("configure a valid Jira username before running IssuesFor")
}

Try / catch

result, err := widget.IssuesFor(ctx, username, jql)
if err != nil {
    if strings.Contains(err.Error(), "failed to convert username") {
        log.Printf("username conversion failed (%v); retrying without username filter", err)
        result, err = widget.IssuesFor(ctx, "", jql) // degrade to unfiltered search
    }
    if err != nil { return err }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/43f1024040234d91. Report an issue: GitHub.