cayleygraph/cayley · error
decoding of %q is not supported
Error message
decoding of %q is not supported
What it means
This error means the quad format was recognized by quad.FormatByName, but the registered Format has a nil Reader, i.e. the format can only be written (serialized), not decoded. Cayley refuses to load data in a write-only format such as pquads (its custom binary format) when used as an input. It exists to distinguish 'unknown format' from 'known but not decodable'.
Source
Thrown at internal/load.go:104
qr = nquads.NewReader(r, false)
default:
var format *quad.Format
if typ == "" {
name := filepath.Base(path)
name = strings.TrimSuffix(name, ".gz")
name = strings.TrimSuffix(name, ".bz2")
format = quad.FormatByExt(filepath.Ext(name))
if format == nil {
typ = "nquads"
}
}
if format == nil {
format = quad.FormatByName(typ)
}
if format == nil {
err = fmt.Errorf("unknown quad format %q", typ)
} else if format.Reader == nil {
err = fmt.Errorf("decoding of %q is not supported", typ)
}
if err != nil {
if c != nil {
c.Close()
}
return nil, err
}
qr = format.Reader(r)
}
if c != nil {
return readCloser{ReadCloser: qr, close: c.Close}, nil
}
return qr, nil
}
// DecompressAndLoad will load or fetch a graph from the given path, decompress
// it, and then call the given load function to process the decompressed graph.
// If no loadFn is provided, db.Load is called.View on GitHub (pinned to 81dcd7d73e)
Solutions
- Pick a decodable input format: dump to nquads (or jsonld) and load that instead of pquads.
- Check format.Reader (or format.Writer) is non-nil programmatically before calling QuadReaderFor.
- If you need round-tripping, use nquads: `cayley dump --format nquads` then `cayley load --format nquads`.
Example fix
// before cayley load --format pquads backup.pquads // after cayley load --format nquads backup.nq
Defensive patterns
Strategy: validation
Validate before calling
if f := quad.FormatByName(formatName); f == nil || f.Reader == nil {
return fmt.Errorf("format %q cannot be used as input; dump to nquads instead", formatName)
}
Prevention
- Remember pquads is write-only (dump); use nquads or jsonld for load.
- Before building load pipelines, check Format.Reader is non-nil for your chosen format.
- Keep dump and load format flags symmetric (nquads on both sides).
When it happens
Trigger: Calling internal.QuadReaderFor (or internal.DecompressAndLoad / `cayley load`) with a type string that resolves to a format whose Format.Reader is nil — for example asking to load from the pquads binary format, which is write-only.
Common situations: Pointing `cayley load` at a database dump produced by cayley dump in pquads format and expecting it to be re-loadable; copying a dump command's format flag into a load command without checking decodability.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- unknown quad format %q
- db: failed to load data: %v
- cannot count iterator without a valid context
- node tokens not valid
- varint: overflow
AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06).
Data as JSON: /api/errors/70ab67edc49fbe5f.
Report an issue: GitHub.