{"record":{"id":"16abda489c115fc6","repo":"gastownhall/beads","slug":"errprefixmismatch","errorCode":"ErrPrefixMismatch","errorMessage":"prefix mismatch","messagePattern":"prefix mismatch","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"issueops/errors.go","lineNumber":99,"sourceCode":"// re-exported here. These are ALIASES, so they are the same values: every\n// existing issueops.ErrX reference and every errors.Is site keeps matching the\n// identical error, and a leaf that never imports issueops still matches it too.\n//\n// They live down there because none of them names an issue: a request can be\n// invalid, a row can be missing and a database can be uninitialized on any\n// plane. The refusals BELOW that name issue concepts stay here.\nvar (\n\t// ErrNotFound is returned when a requested entity does not exist in the database.\n\tErrNotFound = beadserrors.ErrNotFound\n\t// ErrValidation classifies deterministic request-validation failures.\n\tErrValidation = beadserrors.ErrValidation\n\t// ErrNotInitialized is returned when the database has not been initialized\n\t// (e.g., issue_prefix config is missing).\n\tErrNotInitialized = beadserrors.ErrNotInitialized\n)\n\n// ErrPrefixMismatch is returned when an issue ID does not match the configured prefix.\nvar ErrPrefixMismatch = errors.New(\"prefix mismatch\")\n\n// ErrCloseBlocked is returned by CloseIssueChecked when an issue cannot be\n// closed because it is still blocked (is_blocked=1: an open blocking dependency\n// or an open blocking gate). Bypass with CloseIssueOptions.Force.\nvar ErrCloseBlocked = errors.New(\"cannot close blocked issue\")\n\n// ErrCloseOpenChildren is returned when an unforced close finds open\n// parent-child dependents.\nvar ErrCloseOpenChildren = errors.New(\"cannot close issue with open children\")\n\n// CloseOpenChildrenError reports the issue and open-child count that refused a\n// guarded close.\ntype CloseOpenChildrenError struct {\n\tIssueID      string\n\tOpenChildren int\n}\n\nfunc (e *CloseOpenChildrenError) Error() string {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/issueops/errors.go#L81-L117","documentation":"ErrPrefixMismatch is returned when an issue ID does not match the configured issue prefix (e.g. creating an issue with explicit ID 'abc-1' when the configured prefix is 'bd'). Validated by ValidateIssueIDPrefix and surfaced through create flows (failCreateIssue, ClassifyPublicCreateError).","triggerScenarios":"Creating an issue with an explicit ID whose prefix differs from the configured issue_prefix config; useCaseExplicitIDPrefixGuard rejecting explicit IDs; copying IDs from another beads repository/workspace with a different prefix.","commonSituations":"Clone/fork of a repo with a different configured prefix; scripts hard-coding IDs from another project; issue_prefix config missing or changed after migration (related: ErrNotInitialized when config absent).","solutions":["Omit the explicit ID and let the system allocate one with the configured prefix.","Change the explicit ID to use the configured prefix (check issue_prefix config).","Fix the issue_prefix config if it is wrong for this workspace.","Run prefix validation (ValidateIssueIDPrefix) before creating to catch it early."],"exampleFix":"// before\nbd.Create(types.Issue{ID: \"abc-42\", Title: \"x\"}) // prefix mismatch (configured: bd)\n\n// after\nbd.Create(types.Issue{Title: \"x\"}) // ID allocated as bd-N\n// or use \"bd-42\" matching the configured prefix","handlingStrategy":"validation","validationCode":"prefix, _ := store.GetConfig(ctx, \"issue_prefix\")\nif !strings.HasPrefix(explicitID, prefix+\"-\") {\n    return fmt.Errorf(\"ID %s does not use configured prefix %s\", explicitID, prefix)\n}","typeGuard":null,"tryCatchPattern":"if errors.Is(err, issueops.ErrPrefixMismatch) {\n    // drop the explicit ID or fix prefix before retrying create\n}","preventionTips":["Let the system allocate IDs instead of passing explicit ones.","Read issue_prefix from config rather than hard-coding.","Validate explicit IDs with ValidateIssueIDPrefix before create."],"tags":["id-prefix","validation","config"],"backgroundTag":"id-prefix-mismatch","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}