{"record":{"id":"22748bc97b013d93","repo":"ipfs/kubo","slug":"cannot-read-migration-w","errorCode":null,"errorMessage":"cannot read migration: %w","messagePattern":"cannot read migration: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/ipfs/kubo/add_migrations.go","lineNumber":160,"sourceCode":"\t}\n\n\treturn nil\n}\n\nfunc ipfsGet(ctx context.Context, ufs coreiface.UnixfsAPI, ipfsPath path.Path) error {\n\tnd, err := ufs.Get(ctx, ipfsPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer nd.Close()\n\n\tfnd, ok := nd.(files.File)\n\tif !ok {\n\t\treturn fmt.Errorf(\"not a file node: %q\", ipfsPath)\n\t}\n\t_, err = io.Copy(io.Discard, fnd)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot read migration: %w\", err)\n\t}\n\tfmt.Printf(\"Added migration file: %q\\n\", ipfsPath)\n\treturn nil\n}\n","sourceCodeStart":142,"sourceCodeEnd":165,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/cmd/ipfs/kubo/add_migrations.go#L142-L165","documentation":"After asserting the fetched node is a file, ipfsGet streams it to io.Discard purely to verify it can be read end-to-end. Any read error while consuming the file is wrapped as this error, meaning the migration artifact is unreadable or truncated.","triggerScenarios":"io.Copy(io.Discard, fnd) returns an error while reading the migration file from the temp node — e.g. the block data is missing (context deadline), the node's datastore is corrupt, or the underlying RPC/stream breaks mid-read.","commonSituations":"Truncated or corrupted migration binary in the temp node's store; temp node shut down mid-read; bitswap timeout fetching blocks the temp node doesn't actually have.","solutions":["Re-run `ipfs daemon --migrate` to re-download the migration artifact cleanly","Check the temp node's logs for datastore/bitswap errors during the read","Verify the artifact's checksum against the dist.ipfs.tech release; re-fetch if mismatched","Check disk health/space on the temp node's IPFS_PATH","Use the external fs-repo-migrations binary as a fallback"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify artifact checksums against the dist release","Keep the temp node alive for the duration of the migration","Watch for datastore/bitswap errors in temp node logs","Check disk health and free space"],"tags":["migrations","io","corruption"],"backgroundTag":"artifact-read-failed","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"}