Heuristic:1broseidon Ketch Deprecated ErrNotCached
| Knowledge Sources | |
|---|---|
| Domains | Tagging, Deprecation |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
The `cache.ErrNotCached` error is retained only for source compatibility — it is never returned, and callers should treat tagging an uncached URL as a success, not an error.
The Insight (Rule of Thumb)
- Action: Do not check for `cache.ErrNotCached` in new code. A URL can be tagged whether or not its body is cached; `TagURL` reports `cached bool` instead of returning this error.
- Value: The variable is kept so callers compiled against the old behaviour still build, but it will be removed in a later release.
- Trade-off: None for callers — the new behaviour (succeed, report `cached: false`) is strictly more useful than the old (return an error).
- Compatibility: Existing code that switches on `errors.Is(err, cache.ErrNotCached)` will never enter that branch; migrate to the `cached bool` return value.
Reasoning
The tag index is a durable record, not a view over the page cache. When the design shifted so that `tag add` and `--tag` succeed for an uncached URL (storing an entry with no title/description until the page is fetched), `ErrNotCached` became dead code: no code path returns it. It is kept exported so a caller compiled against the prior API does not break at link time, but the deprecation marks it for removal once external callers have migrated to the `cached bool` contract.
The source comment at `cache/tags.go:26-31` makes the intent explicit:
// ErrNotCached is no longer returned: a URL can be tagged whether or not its
// body is cached. Kept so callers compiled against the old behaviour still
// build; it will be removed in a later release.
//
// Deprecated: tagging an uncached URL succeeds and yields an entry with no
// title or description until the page is fetched.
var ErrNotCached = errors.New("page is not in the cache")