Validate Command

Check JSON syntax of minitrace files and directories

Sections

Terminology & Glossary
📖 Documentation
Navigation
20 sectionsv0.1
📄 Validate Command — glaze help validate-command
validate-command

Validate Command

Check JSON syntax of minitrace files and directories

Topicminitracevalidatevalidate

The validate command checks that minitrace JSON files are syntactically valid. It walks files or directories and reports whether each file parses as valid JSON.

Current scope

This is a bootstrap validation implementation. It performs JSON syntax checks only — it does not validate against the minitrace schema (field presence, types, or value constraints). Full schema and semantic validation from the Python reference validator will be ported into pkg/validate in a future release.

For now, use validate to catch truncated files, encoding issues, or accidental corruption after conversion.

Usage

Validate a single file:

go-minitrace validate --path ./output/active/2026-03/abc123.minitrace.json

Validate an entire directory recursively:

go-minitrace validate --path ./output --recursive

Flags

FlagDefaultDescription
--pathFile or directory to validate (required)
--recursivefalseRecursively scan directories for JSON files

Output

Each file produces one row with these fields:

FieldTypeDescription
pathstringAbsolute path to the validated file
valid_jsonboolWhether the file is syntactically valid JSON
errorstringParse error message (empty if valid)

The output goes through Glazed:

# Table output (default)
go-minitrace validate --path ./output --recursive

# JSON for scripting
go-minitrace validate --path ./output --recursive --output json

# Count valid files
go-minitrace validate --path ./output --recursive --output json \
  | jq '[.[] | select(.valid_json)] | length'

Typical workflow

Run validation after conversion to check that all output files are well-formed:

go-minitrace convert claude-code --output-dir ./output
go-minitrace validate --path ./output --recursive

If validation reports errors, the affected files may have been truncated during conversion (e.g., due to disk space) or corrupted afterward. Re-run the conversion for those sessions.

Troubleshooting

ProblemCauseSolution
All files show valid_json: true but queries failJSON is syntactically valid but has unexpected schemaThis is expected; validate currently checks syntax only
valid_json: false on some filesFile was truncated or corruptedRe-convert the source session
Validate is slow on large archivesReads and parses every fileValidate a single period directory instead: --path ./output/active/2026-03/

See also

  • go-minitrace help convert-commands — conversion that produces the files to validate
  • go-minitrace help minitrace-schema — the schema these files should conform to