{"record":{"id":"2c9adc05e1d43e83","repo":"gastownhall/beads","slug":"invalid-issue-type-s","errorCode":null,"errorMessage":"invalid issue type: %s","messagePattern":"invalid issue type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/validation/bead.go","lineNumber":38,"sourceCode":"\t}\n\n\tvar p int\n\tif _, err := fmt.Sscanf(content, \"%d\", &p); err == nil && p >= 0 && p <= 4 {\n\t\treturn p\n\t}\n\treturn -1 // Invalid\n}\n\n// ParseIssueType extracts and validates an issue type from content.\n// Returns the validated type or error if invalid.\n// Supports type aliases like \"enhancement\" -> \"feature\".\nfunc ParseIssueType(content string) (types.IssueType, error) {\n\t// Normalize to support aliases like \"enhancement\" -> \"feature\"\n\tissueType := types.IssueType(strings.TrimSpace(content)).Normalize()\n\n\t// Use the canonical IsValid() from types package\n\tif !issueType.IsValid() {\n\t\treturn types.TypeTask, fmt.Errorf(\"invalid issue type: %s\", content)\n\t}\n\n\treturn issueType, nil\n}\n\n// ValidatePriority parses and validates a priority string.\n// Returns the parsed priority (0-4) or an error if invalid.\n// Supports both numeric (0-4) and P-prefix format (P0-P4).\nfunc ValidatePriority(priorityStr string) (int, error) {\n\tpriority := ParsePriority(priorityStr)\n\tif priority == -1 {\n\t\treturn -1, fmt.Errorf(\"invalid priority %q (expected 0-4 or P0-P4, not words like high/medium/low)\", priorityStr)\n\t}\n\treturn priority, nil\n}\n\n// ValidateIDFormat validates that an ID has the correct format.\n// Supports: prefix-number (bd-42), prefix-hash (bd-a3f8e9), or hierarchical (bd-a3f8e9.1)","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/validation/bead.go#L20-L56","documentation":"ParseIssueType validates a user-supplied issue type string and returns this error when, after trimming whitespace and normalizing aliases (e.g. \"enhancement\" -> \"feature\"), the value is not one of the canonical types recognized by types.IssueType.IsValid(). The library supports a fixed set of types (bug, feature, task, epic, chore); anything else is rejected.","triggerScenarios":"Calling validation.ParseIssueType with a string not in the canonical set or its aliases — e.g. \"story\", \"spike\", \"Feature Request\", \"bugfix\", or an empty-after-trim string. The error reports the original (un-normalized) content.","commonSituations":"Typing \"enhancement\" in an old version without the alias; scripts exporting types from another tracker (Jira \"story\", GitHub \"enhancement\" on old beads); non-English type names; accidental capitalization plus unrecognized word like \"BUGFIX\" in older builds lacking case normalization.","solutions":["Use one of the canonical types: bug, feature, task, epic, chore","Use the alias \"enhancement\" (normalized to feature) if that is the intent","Upgrade beads if relying on aliases not present in your installed version","Normalize/whitelist types in your import script before calling ParseIssueType"],"exampleFix":"// before\nt, err := validation.ParseIssueType(\"bugfix\") // invalid\n// after\nt, err := validation.ParseIssueType(\"bug\") // canonical type (or \"enhancement\" -> feature)","handlingStrategy":"validation","validationCode":"var validTypes = map[string]bool{\"bug\":true,\"feature\":true,\"task\":true,\"epic\":true,\"chore\":true,\"enhancement\":true}\nfunc validType(s string) bool { return validTypes[strings.ToLower(strings.TrimSpace(s))] }","typeGuard":null,"tryCatchPattern":"t, err := validation.ParseIssueType(content)\nif err != nil {\n    return fmt.Errorf(\"%w (allowed: bug, feature, task, epic, chore)\", err)\n}","preventionTips":["Whitelist types in import scripts before calling ParseIssueType","Normalize casing and trim whitespace on user input","Map foreign tracker types (story->feature, enhancement->feature) up front","Keep beads updated so alias normalization matches docs"],"tags":["validation","issue-type","input","go"],"backgroundTag":"invalid-issue-type","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}