gastownhall/beads · error
failed to import from JSONL
Error message
failed to import from JSONL: %v
What it means
After the --from-jsonl file is found, `bd init` imports it via importFromLocalJSONL. If that import fails (parse errors, schema problems, storage write errors), bd closes the store and wraps the underlying error with this message.
Solutions
- Inspect the wrapped %v error to find the offending line/reason
- Validate the JSONL: each line must be a complete issue JSON object (jq -c . < file)
- Repair or truncate the file at the bad line, or re-export it from the source repo
- Re-run bd init --from-jsonl after fixing the file
Example fix
// before (truncated last line)
{"id":"x-1",...}
{"id":"x-2", <- truncated
// after
$ tail -1 .beads/issues.jsonl # remove bad line
$ bd init --from-jsonl Defensive patterns
Strategy: validation
Validate before calling
# pre-validate every line parses as JSON n=0; while IFS= read -r line; do n=$((n+1)); printf '%s' "$line" | jq -e . >/dev/null || echo "bad JSON at line $n" done < .beads/issues.jsonl
Try / catch
bd init --from-jsonl 2>import.log || {
grep -F 'failed to import from JSONL' import.log
# fix the offending line, then retry
} Prevention
- Validate JSONL with jq line-by-line before import
- Ensure exports are complete (no truncated final line)
- Avoid hand-editing exported issues.jsonl
- Re-export from the source repo instead of patching bad data
When it happens
Trigger: importFromLocalJSONL(ctx, store, localJSONLPath) returns a non-nil error during `bd init --from-jsonl`.
Common situations: Malformed JSONL (truncated file, invalid JSON on a line), issues missing required fields, duplicate/invalid dependency references, or a storage-level failure while writing the issues into the fresh Dolt database.
Related errors
- --from-jsonl specified but
- failed to parse issue from JSONL
- failed to parse JSONL line
- failed to read JSONL file
- failed to scan JSONL
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/92d5de484910e3ab.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/bd/init.go:1823
if shouldWriteInitStateToDB(doltCfg.Gateway) {
if err := store.SetMetadata(ctx, "last_import_time", time.Now().Format(time.RFC3339)); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to initialize last_import_time: %v\n", err)
// Non-fatal - continue anyway
}
}
// Import from local JSONL if requested (GH#2023).
// This must run after the store is created and prefix is set.
if fromJSONL {
localJSONLPath := configuredImportJSONLPath(beadsDir)
if _, statErr := os.Stat(localJSONLPath); os.IsNotExist(statErr) {
_ = store.Close()
return fmt.Errorf("--from-jsonl specified but %s does not exist", localJSONLPath)
}
issueCount, importErr := importFromLocalJSONL(ctx, store, localJSONLPath)
if importErr != nil {
_ = store.Close()
return fmt.Errorf("failed to import from JSONL: %v", importErr)
}
if !quiet {
fmt.Printf(" Imported %d issues from %s\n", issueCount, localJSONLPath)
}
}
// Prompt for contributor mode if:
// - In a git repo (needed to set beads.role config)
// - Interactive terminal (stdin is TTY) and not --non-interactive
// - No explicit --contributor or --team flag provided
// - No explicit --role flag provided
if isGitRepo() && !contributor && !team && roleFlag == "" && !nonInteractive && shouldPromptForRole() {
promptedContributor, err := promptContributorMode()
if err != nil {
if isCanceled(err) {
fmt.Fprintln(os.Stderr, "Setup canceled.")
_ = store.Close()
return errCanceled()View on GitHub (pinned to 71377f2769)