{"record":{"id":"340c2b6f8e9b1060","repo":"ipfs/kubo","slug":"invalid-ipns-record-w","errorCode":null,"errorMessage":"invalid IPNS record: %w","messagePattern":"invalid IPNS record: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/name/name.go","lineNumber":500,"sourceCode":"\n\t\t// Read record data (limit to 1 MiB for memory safety)\n\t\tdata, err := io.ReadAll(io.LimitReader(file, 1<<20))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read record: %w\", err)\n\t\t}\n\t\tif len(data) == 0 {\n\t\t\treturn errors.New(\"record is empty\")\n\t\t}\n\n\t\t// Validate unless --force\n\t\tif !force {\n\t\t\t// Check size limit per IPNS spec\n\t\t\tif len(data) > maxIPNSRecordSize {\n\t\t\t\treturn fmt.Errorf(\"record exceeds maximum size of %d bytes, use --force to skip size check\", maxIPNSRecordSize)\n\t\t\t}\n\t\t\trec, err := ipns.UnmarshalRecord(data)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid IPNS record: %w\", err)\n\t\t\t}\n\n\t\t\t// Validate signature against provided name\n\t\t\terr = ipns.ValidateWithName(rec, name)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"record validation failed: %w\", err)\n\t\t\t}\n\n\t\t\t// Check for sequence conflicts with existing record\n\t\t\texistingData, err := api.Routing().Get(req.Context, nameArg)\n\t\t\tif err == nil {\n\t\t\t\t// Allow republishing the exact same record (common use case:\n\t\t\t\t// get a third-party record and put it back to refresh DHT)\n\t\t\t\tif !bytes.Equal(existingData, data) {\n\t\t\t\t\texistingRec, parseErr := ipns.UnmarshalRecord(existingData)\n\t\t\t\t\tif parseErr == nil {\n\t\t\t\t\t\texistingSeq, seqErr := existingRec.Sequence()\n\t\t\t\t\t\tnewSeq, newSeqErr := rec.Sequence()","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/name/name.go#L482-L518","documentation":"Raised by 'ipfs name put' when the provided record bytes cannot be unmarshalled as an IPNS record (ipns.UnmarshalRecord fails): the data is not a well-formed IPNS record (wrong format, corrupt protobuf, or truncated file). Validation only runs without --force.","triggerScenarios":"Thrown at core/commands/name/name.go:500 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-export the record from its source (e.g. 'ipfs name get <name> --record /path') and make sure the file was not truncated or modified in transfer","Verify the file actually contains an IPNS record and not a plain CID/path or other content","If you intentionally want to store unvalidated bytes, pass --force to skip validation (size check and unmarshal)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}