wtfutil/wtf · error
failed to extract account ID from converted query: %s
Error message
failed to extract account ID from converted query: %s
What it means
After obtaining the converted JQL query, ConvertJQLWithUsername runs extractAccountIDFromJQL to pull the account ID out of the assignee clause. If the converted query contains no recognizable account ID (e.g. 'accountID in ("...")' pattern doesn't match), it refuses to cache and fails, since caching a wrong/empty mapping would poison later requests.
Source
Thrown at modules/jira/client.go:149
}
var conversionResult JQLConversionResponse
err = utils.ParseJSON(&conversionResult, bytes.NewReader(resp))
if err != nil {
return "", err
}
if len(conversionResult.QueryStrings) == 0 {
return "", fmt.Errorf("no conversion result for username: %s", username)
}
// Return the converted JQL query part (just the assignee part)
convertedQuery := conversionResult.QueryStrings[0].ConvertedQuery
// Extract account ID properly
accountID := extractAccountIDFromJQL(convertedQuery)
if accountID == "" {
return "", fmt.Errorf("failed to extract account ID from converted query: %s", convertedQuery)
}
// Cache the result for 10 minutes
userIDCache.Set(username, accountID, 10*time.Minute)
return convertedQuery, nil
}
// extractAccountIDFromJQL extracts the account ID from a converted JQL query
func extractAccountIDFromJQL(jql string) string {
// Example: "assignee = \"account:5b10ac8d82e05b22cc7d4ef5\""
// We want to extract: "account:5b10ac8d82e05b22cc7d4ef5"
start := strings.Index(jql, "\"")
if start == -1 {
return ""
}
View on GitHub (pinned to bb838c1ccb)
Solutions
- Update extractAccountIDFromJQL's regex to match the current Jira pdcleaner response format
- Log the convertedQuery from the error to see the actual clause returned
- Check for Jira API changelog notes about /rest/api/3/jql/pdcleaner output changes
- Fall back to resolving the account ID via /rest/api/3/user/query instead
Example fix
// before
re := regexp.MustCompile(`accountID in \("([^"]+)"\)`)
// after (tolerate optional spaces / multiple ids)
re := regexp.MustCompile(`accountID\s+in\s+\("([^"]+)"`) Defensive patterns
Strategy: validation
Validate before calling
// verify the converted clause actually embeds an account ID
var accountIDRe = regexp.MustCompile(`accountID\s+in\s+\("[^"]+"`)
if !accountIDRe.MatchString(convertedQuery) {
return fmt.Errorf("converted query lacks account ID: %s", convertedQuery)
} Type guard
func hasAccountID(q string) bool {
return extractAccountIDFromJQL(q) != ""
} Try / catch
query, err := widget.ConvertJQLWithUsername(username)
if err != nil {
if strings.Contains(err.Error(), "failed to extract account ID") {
log.Printf("Jira pdcleaner format changed; inspect converted query in msg: %v", err)
}
return err
} Prevention
- Pin-test extractAccountIDFromJQL against real pdcleaner responses in CI
- Log the converted query when extraction fails to detect format drift
- Track Atlassian API changelog for /jql/pdcleaner changes
- Prefer resolving account IDs via /rest/api/3/user/query as a backup
When it happens
Trigger: Jira's pdcleaner returns a ConvertedQuery whose assignee clause doesn't contain the account-ID pattern the regex expects - e.g. it returns the original username form or a differently formatted clause.
Common situations: Jira Cloud API response format drift (new API versions changing the accountID clause), users resolved via email rather than account ID, usernames that map to group-like clauses, custom forks altering extractAccountIDFromJQL.
Related errors
- failed to parse JQL search response: %v
- failed to parse issue %s: %v
- failed to marshal request: %v
- no conversion result for username: %s
- failed to convert username %s to account ID: %v
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/36594d25c094e7b0.
Report an issue: GitHub.