JuliusBrussee/caveman · error
empty a11y recovery metadata
Error message
empty a11y recovery metadata
What it means
Thrown by Session.targetsForHandle when metadata retrieved from the Engine for an a11y recovery handle is empty. The handle exists in the store but holds no UID->Target map, so the session cannot reconstruct page targets for element interaction.
Solutions
- Verify the handle string is the exact value returned by the snapshot call.
- Take a fresh snapshot to generate a new handle with complete metadata.
- Check store contents for the handle; if metadata is missing server-side, re-create the record.
- Ensure library versions writing and reading the store match (metadata format compatibility).
Example fix
// before
handle := "snap_abc" // truncated/partial
out, err := sess.Snapshot(handle)
// after
handle, err := sess.TakeSnapshot()
if err != nil { return err }
out, err := sess.Snapshot(handle) Defensive patterns
Strategy: validation
Validate before calling
if handle == "" { return errors.New("empty snapshot handle") }
meta, err := eng.RetrieveMetadata(handle)
if err != nil { return err }
if len(meta) == 0 { return takeFreshSnapshot() } Try / catch
targets, err := sess.Snapshot(handle)
if err != nil && strings.Contains(err.Error(), "empty a11y recovery metadata") {
// stale or truncated record: regenerate
newHandle, ferr := sess.TakeSnapshot()
if ferr != nil { return ferr }
return sess.Snapshot(newHandle)
}
return err Prevention
- Treat handles as opaque; only use values returned by the library.
- Avoid mixing store contents across library versions.
- Validate store integrity after migrations/compaction.
- Regenerate snapshots rather than persisting long-lived handles.
When it happens
Trigger: snapshotTool resolves a handle whose RetrieveMetadata returned zero bytes: the handle was stored without metadata (older format), the record was truncated, or the wrong handle string was passed.
Common situations: Mixing handles from different library versions; manually constructed/typo'd handle; a store migration or compaction dropped metadata bodies; passing a plain ID where a full handle is expected.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- ccr: recovery handle not found
- LiteLLM metadata must be a native dictionary
- ssrf: destination (for host ) is in blocked range
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/c88d75d721e205e1.
Report an issue: GitHub.
Appendix: source
Thrown at browse/session.go:213
s.replaceTargets(targets)
return mcp.ToolRawText(text)
}
func snapshotTimeout(wait time.Duration) time.Duration {
base := 15 * time.Second
if wait > 0 {
base += wait
}
return base
}
func (s *Session) targetsForHandle(handle string) (map[string]Target, error) {
meta, err := s.eng.RetrieveMetadata(handle)
if err != nil {
return nil, err
}
if len(meta) == 0 {
return nil, errors.New("empty a11y recovery metadata")
}
var decoded struct {
UIDs map[string]Target `json:"uids"`
}
if err := json.Unmarshal(meta, &decoded); err != nil {
return nil, err
}
if decoded.UIDs == nil {
decoded.UIDs = map[string]Target{}
}
return decoded.UIDs, nil
}
func finalizeSnapshotPayload(payload snapshotPayload) (snapshotPayload, string) {
counter := tokens.Default()
for range 8 {
encoded, _ := json.Marshal(payload)
delivered := counter.Count(encoded)View on GitHub (pinned to 3ee70a1026)