{"record":{"id":"ed5d863aad03e451","repo":"gastownhall/beads","slug":"issue-s-is-not-eligible-for-tier-1-compaction-s","errorCode":null,"errorMessage":"issue %s is not eligible for Tier 1 compaction: %s","messagePattern":"issue (.+?) is not eligible for Tier 1 compaction: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/compact/compactor.go","lineNumber":100,"sourceCode":"\t\tsummarizer: haiClient,\n\t\tconfig:     config,\n\t}, nil\n}\n\n// CompactTier1 compacts a single issue at Tier 1 (basic summarization).\nfunc (c *Compactor) CompactTier1(ctx context.Context, issueID string) error {\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\n\t// Check eligibility before fetching issue (fail fast)\n\teligible, reason, err := c.store.CheckEligibility(ctx, issueID, 1)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to verify eligibility: %w\", err)\n\t}\n\tif !eligible {\n\t\tif reason != \"\" {\n\t\t\treturn fmt.Errorf(\"issue %s is not eligible for Tier 1 compaction: %s\", issueID, reason)\n\t\t}\n\t\treturn fmt.Errorf(\"issue %s is not eligible for Tier 1 compaction\", issueID)\n\t}\n\n\tissue, err := c.store.GetIssue(ctx, issueID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to fetch issue: %w\", err)\n\t}\n\n\t// Calculate original size\n\toriginalSize := len(issue.Description) + len(issue.Design) + len(issue.Notes) + len(issue.AcceptanceCriteria)\n\n\tif c.config.DryRun {\n\t\treturn fmt.Errorf(\"dry-run: would compact %s (original size: %d bytes)\", issueID, originalSize)\n\t}\n\n\t// Get summary from AI\n\tsummary, err := c.summarizer.SummarizeTier1(ctx, issue)","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/compact/compactor.go#L82-L118","documentation":"CheckEligibility returned eligible=false together with a non-empty reason string, so CompactTier1 refuses to compact and reports the store's reason. This is an expected policy rejection, not an internal failure — the issue fails one of the Tier 1 eligibility rules (e.g. already compacted, too small, closed).","triggerScenarios":"Calling CompactTier1 on an issue the store deems ineligible, with a reason — e.g. the issue is closed, already has a compaction record, or its content is below the minimum size threshold.","commonSituations":"Re-running compaction on an already-compacted issue; targeting a closed issue; scripting over many issues where some are intentionally skipped; typos leading to the wrong issue ID being selected.","solutions":["Read the appended reason in the message to see which eligibility rule failed","Filter candidate issues through CheckEligibility yourself before batch compaction","Reopen the issue or adjust its state if the reason is stale/incorrect","Skip the issue if ineligible — this is an expected outcome in batch runs"],"exampleFix":"// before\nfor _, id := range ids {\n    if err := c.CompactTier1(ctx, id); err != nil { return err } // aborts on first ineligible\n}\n// after\nfor _, id := range ids {\n    if err := c.CompactTier1(ctx, id); err != nil {\n        if strings.Contains(err.Error(), \"not eligible for Tier 1 compaction\") { continue }\n        return err\n    }\n}","handlingStrategy":"validation","validationCode":"eligible, reason, err := store.CheckEligibility(ctx, issueID, 1)\nif err != nil { return err }\nif !eligible {\n    log.Printf(\"skipping %s: %s\", issueID, reason)\n    continue\n}","typeGuard":null,"tryCatchPattern":"if err := c.CompactTier1(ctx, id); err != nil {\n    if strings.Contains(err.Error(), \"not eligible for Tier 1 compaction\") {\n        return nil // expected policy skip\n    }\n    return err\n}","preventionTips":["Call CheckEligibility yourself before invoking CompactTier1 in batch jobs","Skip closed and already-compacted issues up front","Log and continue on ineligibility instead of aborting the whole batch"],"tags":["go","validation","eligibility","policy"],"backgroundTag":"compaction-ineligible","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}