gastownhall/beads · error
read adaptive id config: %w
Error message
read adaptive id config: %w
What it means
Wraps failure of cfgRepo.GetAdaptiveIDConfig during mintTopLevelID's hash-ID path. This config supplies min/max adaptive hash-length parameters; without it bd cannot size candidate IDs.
Source
Thrown at internal/storage/domain/issue.go:1617
// because there is no wisp_counter table and ephemeral churn would make
// a monotonic counter meaningless.
if !useWisp {
mode, err := u.cfgRepo.GetConfig(ctx, "issue_id_mode")
if err != nil {
return "", fmt.Errorf("read issue_id_mode: %w", err)
}
if mode == "counter" {
n, err := u.issueRepo.NextCounterID(ctx, prefix)
if err != nil {
return "", err
}
return fmt.Sprintf("%s-%d", prefix, n), nil
}
}
cfg, err := u.cfgRepo.GetAdaptiveIDConfig(ctx)
if err != nil {
return "", fmt.Errorf("read adaptive id config: %w", err)
}
tableOpts := IssueTableOpts{UseWispsTable: useWisp}
count, err := u.issueRepo.CountForPrefix(ctx, prefix, tableOpts)
if err != nil {
return "", err
}
baseLength := ComputeAdaptiveLength(count, cfg)
if baseLength > cfg.MaxLength {
baseLength = cfg.MaxLength
}
for length := baseLength; length <= cfg.MaxLength; length++ {
for nonce := 0; nonce < 10; nonce++ {
candidate := idgen.GenerateHashID(prefix, issue.Title, issue.Description, actor, issue.CreatedAt, length, nonce)
exists, err := u.issueRepo.Exists(ctx, candidate, tableOpts)
if err != nil {
return "", errView on GitHub (pinned to 71377f2769)
Solutions
- Re-run bd init / migration to populate adaptive-ID config defaults.
- Verify config keys for adaptive ID exist in the config table via dolt sql.
- Check DB/driver connectivity and retry.
- Upgrade/downgrade alignment: ensure bd version matches DB schema version.
Defensive patterns
Strategy: fallback
Validate before calling
cfg, err := cfgRepo.GetAdaptiveIDConfig(ctx)
if err != nil || cfg.MaxLength == 0 {
cfg = DefaultAdaptiveIDConfig() // sane fallback
} Try / catch
if err != nil {
if errors.Is(err, ErrConfigNotFound) {
cfg = DefaultAdaptiveIDConfig() // fall back to defaults
} else {
return fmt.Errorf("adaptive id config unreadable: %w", err)
}
} Prevention
- Run bd init/migrations after upgrading so adaptive-ID keys exist.
- Never prune unknown rows from the config table.
- Pin bd binary version to the DB schema version.
- Validate config completeness in CI (bd doctor).
When it happens
Trigger: Minting a hash-mode ID (wisp, or regular issue when issue_id_mode != counter) while GetAdaptiveIDConfig errors: config keys absent, storage failure, canceled context.
Common situations: Workspace initialized by an older bd that predates adaptive-ID config keys; manually pruned config table; DB outage mid-create.
Related errors
- read issue_prefix: %w
- read issue_id_mode: %w
- failed to set routing.contributor: %w
- failed to set sync branch: %w
- failed to enable team mode: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/22e6af122f0cbf6a.
Report an issue: GitHub.