{"record":{"id":"70ab67edc49fbe5f","repo":"cayleygraph/cayley","slug":"decoding-of-q-is-not-supported","errorCode":null,"errorMessage":"decoding of %q is not supported","messagePattern":"decoding of %q is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/load.go","lineNumber":104,"sourceCode":"\t\tqr = nquads.NewReader(r, false)\n\tdefault:\n\t\tvar format *quad.Format\n\t\tif typ == \"\" {\n\t\t\tname := filepath.Base(path)\n\t\t\tname = strings.TrimSuffix(name, \".gz\")\n\t\t\tname = strings.TrimSuffix(name, \".bz2\")\n\t\t\tformat = quad.FormatByExt(filepath.Ext(name))\n\t\t\tif format == nil {\n\t\t\t\ttyp = \"nquads\"\n\t\t\t}\n\t\t}\n\t\tif format == nil {\n\t\t\tformat = quad.FormatByName(typ)\n\t\t}\n\t\tif format == nil {\n\t\t\terr = fmt.Errorf(\"unknown quad format %q\", typ)\n\t\t} else if format.Reader == nil {\n\t\t\terr = fmt.Errorf(\"decoding of %q is not supported\", typ)\n\t\t}\n\t\tif err != nil {\n\t\t\tif c != nil {\n\t\t\t\tc.Close()\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tqr = format.Reader(r)\n\t}\n\tif c != nil {\n\t\treturn readCloser{ReadCloser: qr, close: c.Close}, nil\n\t}\n\treturn qr, nil\n}\n\n// DecompressAndLoad will load or fetch a graph from the given path, decompress\n// it, and then call the given load function to process the decompressed graph.\n// If no loadFn is provided, db.Load is called.","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/internal/load.go#L86-L122","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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`."],"exampleFix":"// before\ncayley load --format pquads backup.pquads\n// after\ncayley load --format nquads backup.nq","handlingStrategy":"validation","validationCode":"if f := quad.FormatByName(formatName); f == nil || f.Reader == nil {\n\treturn fmt.Errorf(\"format %q cannot be used as input; dump to nquads instead\", formatName)\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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)."],"tags":["go","quad-format","unsupported-operation","loading"],"backgroundTag":"unsupported-operation","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}