gastownhall/beads · error
inspect quarantine target
Error message
inspect quarantine target %s: %w
What it means
quarantineRecord probes candidate target names <name>.stale-<unix-ts> with os.Lstat to find a free one; this error is returned when Lstat fails with something other than 'not exists', meaning it could not determine whether the target path is free. The quarantine rename is abandoned.
Solutions
- Inspect the wrapped Lstat error (ls -la the workspace for symlink loops or odd entries matching *.stale-*)
- Remove or fix the problematic entry (broken symlink, wrong ownership) in the workspace root
- Shorten the workspace path if ENAMETOOLONG is the cause
- Re-run the command after the filesystem settles (transient EACCES from AV/indexers usually clears)
Example fix
// before
if _, err := os.Lstat(target); err == nil {
continue
} else if !errors.Is(err, fs.ErrNotExist) {
return "", fmt.Errorf("inspect quarantine target %s: %w", target, err)
}
// after
if _, err := os.Lstat(target); err == nil {
continue
} else if errors.Is(err, fs.ErrNotExist) || errors.Is(err, syscall.EACCES) { // treat denied stat as free
_ = err
} else {
return "", fmt.Errorf("inspect quarantine target %s: %w", target, err)
} Defensive patterns
Strategy: validation
Validate before calling
for _, e := range staleCandidates(root, PIDFileName) {
if fi, err := os.Lstat(e); err != nil && !errors.Is(err, fs.ErrNotExist) {
return fmt.Errorf("precheck: %s: %w", e, err) // fix perms/symlinks first
}
} Try / catch
target, err := quarantineRecord(root, PIDFileName, time.Now())
if err != nil && strings.Contains(err.Error(), "inspect quarantine target") {
// broken symlink or EACCES on a stale-<ts> name: remove/fix it, then retry
} Prevention
- Don't create symlink loops or directories named like *.stale-* in the workspace
- Keep workspace paths short enough to avoid ENAMETOOLONG
- Exclude workspace from AV/indexers that interfere with stat calls
- Periodically remove abandoned .stale-* files from long-lived workspaces
When it happens
Trigger: os.Lstat(target) returns e.g. EACCES, ELOOP, or ENAMETOOLONG while iterating candidate stale-file names in the workspace root.
Common situations: Search-index or AV interfering with stat calls on Windows; a symlink loop or oddly-permissioned directory entry named like a stale quarantine file; an extremely long workspace path hitting ENAMETOOLONG.
Related errors
- failed to inspect
- failed to pin target directory identity
- proxy.ForceStopUnverified: quarantine
- quarantine dead unverifiable backend record
- quarantine orphan backend record
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/f29b559fd6ac1535.
Report an issue: GitHub.
Appendix: source
Thrown at internal/storage/dbproxy/proxy/endpoint.go:702
default:
return fmt.Errorf("cannot spawn from proxy discovery status %s", discovery.status)
}
target, err := quarantineRecord(rootDir, PIDFileName, time.Now())
if err != nil {
return fmt.Errorf("quarantine proxy record: %w", err)
}
log.Printf("dbproxy: preserved proxy record as %s", target)
return nil
}
func quarantineRecord(rootDir, name string, now time.Time) (string, error) {
source := pidfile.Path(rootDir, name)
for stamp := now.Unix(); ; stamp++ {
target := filepath.Join(rootDir, name+".stale-"+strconv.FormatInt(stamp, 10))
if _, err := os.Lstat(target); err == nil {
continue
} else if !errors.Is(err, fs.ErrNotExist) {
return "", fmt.Errorf("inspect quarantine target %s: %w", target, err)
}
if err := os.Rename(source, target); err != nil {
return "", fmt.Errorf("rename %s to %s: %w", source, target, err)
}
return target, nil
}
}
func sweepOldQuarantines(rootDir string, now time.Time) error {
entries, err := os.ReadDir(rootDir)
if err != nil {
return err
}
cutoff := now.Add(-quarantineRetention).Unix()
prefixes := []string{
PIDFileName + ".stale-",
server.PIDFileName + ".stale-",
}View on GitHub (pinned to 71377f2769)