gastownhall/beads · error
read dependency file: %w
Error message
read dependency file: %w
What it means
Wraps bufio.Scanner errors encountered while streaming the bulk dependency file in readBulkDepEdges. os.Open succeeded but a read failed mid-scan (I/O error, device disconnected, binary garbage causing scanner issues on huge lines). Thrown after the parse loop finishes if scanner.Err() is non-nil.
Source
Thrown at cmd/bd/dep.go:674
dt := canonicalDependencyType(types.DependencyType(depType))
typeErr := validateDependencyType(dt)
if typeErr != nil {
errs = append(errs, fmt.Sprintf("line %d: %v", lineNo, typeErr))
}
if from == "" || to == "" || typeErr != nil {
continue
}
edges = append(edges, bulkDepEdge{
Line: lineNo,
IssueID: from,
DependsOnID: to,
Type: dt,
Defaulted: defaulted,
})
}
if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("read dependency file: %w", err)
}
if len(errs) > 0 {
return nil, bulkDepValidationError(errs)
}
return edges, nil
}
func validateBulkDepEdges(ctx context.Context, edges []bulkDepEdge) ([]bulkDepEdge, error) {
resolved := make([]bulkDepEdge, 0, len(edges))
var errs []string
for _, edge := range edges {
current := edge
// Write-intent: addBulkDependencies writes through current.Store (the
// source issue's store), so a routed source must open writable (#4141);
// the depends-on target below stays read-only (bd-6dnrw.32, GH#3231).
fromID, fromStore, fromCleanup, err := resolveIDForMutation(ctx, store, edge.IssueID)
if err != nil {View on GitHub (pinned to 71377f2769)
Solutions
- Check for unusually long lines in the file (awk 'length($0)>65536' deps.txt) and split them; the default scanner limit is 64KB per line.
- Re-run the command — transient I/O errors (NFS, removable media) often clear on retry.
- Verify the file is plain text, not binary or compressed (file deps.txt).
- If lines are legitimately huge, pre-split the file into smaller chunk files and run one bulk add per chunk.
Example fix
// before (one enormous line, >64KB, fails with 'bufio.Scanner: token too long') bd dep add bd-1 --file huge-deps.txt // after: split into chunks under the scanner limit split -l 1000 huge-deps.txt chunk- for c in chunk-*; do bd dep add bd-1 --file "$c"; done
Defensive patterns
Strategy: retry
Validate before calling
// ensure no line exceeds bufio.Scanner's 64KB default limit
awk 'length($0) > 65536 { print "line " NR " too long (" length($0) " chars)"; bad=1 } END { exit bad }' "$DEPS_FILE" Try / catch
for attempt in 1 2 3; do bd dep add bd-1 --file deps.txt && break sleep $((attempt * 2)) done
Prevention
- Keep dependency-file lines short; split bulk lists into chunks.
- Do not modify or replace the file while a bulk add is running.
- Avoid reading dependency files from flaky network mounts; copy locally first.
When it happens
Trigger: Calling `bd dep add -f <file>` where the underlying file descriptor fails during scanning: hardware/disk I/O error, file truncated or removed mid-read (e.g. reading from /proc-like or FIFO), or lines exceeding bufio.Scanner's 64KB default token limit.
Common situations: A very long dependency line in the file exceeding the 64KB bufio.Scanner buffer; networked filesystem dropout; file replaced while a long-running bulk add is in progress.
Related errors
- open dependency file: %w
- error reading %s: %w
- no store is open for this workspace
- no absolute native user directory is available
- ExternalDoltConfig: set either Socket OR (Host, Port), not b
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/e585d9a150c0eac0.
Report an issue: GitHub.