{"record":{"id":"dcb1a154d28e98e8","repo":"gastownhall/beads","slug":"w-issue-id-s-does-not-match-configured-prefix","errorCode":null,"errorMessage":"%w: issue ID %s does not match configured prefix %s","messagePattern":"%w: issue ID (.+?) does not match configured prefix (.+?)","errorType":"validation","errorClass":"storage.ErrPrefixMismatch","httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue.go","lineNumber":1072,"sourceCode":"\t\t\treturn result, fmt.Errorf(\"create: add waits-for: %w\", err)\n\t\t}\n\t\tresult.PostCreateWrites = true\n\t}\n\n\treturn result, nil\n}\n\nfunc validateExplicitIDPrefix(id, prefix, allowedPrefixes string) error {\n\tif strings.HasPrefix(id, prefix+\"-\") {\n\t\treturn nil\n\t}\n\tfor _, allowed := range strings.Split(allowedPrefixes, \",\") {\n\t\tallowed = strings.TrimSpace(allowed)\n\t\tif allowed != \"\" && strings.HasPrefix(id, allowed+\"-\") {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"%w: issue ID %s does not match configured prefix %s\", storage.ErrPrefixMismatch, id, prefix)\n}\n\nfunc (u *issueUseCaseImpl) CreateIssues(ctx context.Context, params []CreateIssueParams, actor string) (CreateIssuesResult, error) {\n\treturn u.createMany(ctx, params, actor, false)\n}\n\nfunc (u *issueUseCaseImpl) CreateWisps(ctx context.Context, params []CreateIssueParams, actor string) (CreateIssuesResult, error) {\n\treturn u.createMany(ctx, params, actor, true)\n}\n\nfunc (u *issueUseCaseImpl) createMany(ctx context.Context, params []CreateIssueParams, actor string, useWisp bool) (CreateIssuesResult, error) {\n\tresult := CreateIssuesResult{}\n\tfor i := range params {\n\t\tr, err := u.create(ctx, params[i], actor, useWisp)\n\t\tif err != nil {\n\t\t\treturn result, fmt.Errorf(\"createMany[%d]: %w\", i, err)\n\t\t}\n\t\tresult.Issues = append(result.Issues, r.Issue)","sourceCodeStart":1054,"sourceCodeEnd":1090,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue.go#L1054-L1090","documentation":"Returned (wrapping storage.ErrPrefixMismatch) when validating that a given issue ID starts with one of the configured allowed ID prefixes. Each prefix must appear as '<prefix>-' at the start of the ID. This enforces organization-wide ID naming configured via the prefix setting.","triggerScenarios":"Calling an update/import/validation path with an issue ID whose prefix does not match the configured prefix (e.g. ID 'proj-123' when prefix is 'bd', or prefix list doesn't include the ID's prefix).","commonSituations":"Changing the configured prefix after issues were created with an older prefix; importing issues from another repo/workspace with different prefixes; typo'd or copied IDs from another project; multiple prefixes configured but the CSV list missing one.","solutions":["Update the configured prefix (or comma-separated allowed prefixes) to include the ID's actual prefix","Re-prefix the issue ID to match configuration (create anew with the correct prefix)","If migrating prefixes, bulk-update IDs or accept/re-map imports before validation","Check for whitespace/typo in the prefix config"],"exampleFix":"// before: config prefix 'bd' but ID from another repo\nissueID := \"proj-42\"\n// after: align config to allow both, or remap the ID\nallowedPrefixes = \"bd,proj\"\n// or\nissueID = \"bd-42\"","handlingStrategy":"validation","validationCode":"func validPrefix(id, prefix string) bool {\n    for _, p := range strings.Split(prefix, \",\") {\n        p = strings.TrimSpace(p)\n        if p != \"\" && strings.HasPrefix(id, p+\"-\") {\n            return true\n        }\n    }\n    return false\n}\n// call before importing: if !validPrefix(issueID, cfg.Prefix) { remap(issueID) }","typeGuard":null,"tryCatchPattern":"if err := importIssues(ctx, issues); err != nil {\n    if errors.Is(err, storage.ErrPrefixMismatch) {\n        // remap IDs to the configured prefix and retry\n    }\n}","preventionTips":["Keep the configured prefix stable; if it changes, migrate existing IDs","When importing from other repos, remap IDs to the local prefix first","Configure multiple comma-separated prefixes if multiple ID sources are legitimate","Check errors.Is(err, storage.ErrPrefixMismatch) for programmatic handling"],"tags":["validation","prefix","issue-id","config"],"backgroundTag":"id-prefix-mismatch","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}