{"record":{"id":"85c3c627dddeb51f","repo":"ipfs/kubo","slug":"file-argument-was-nil","errorCode":null,"errorMessage":"file argument was nil","messagePattern":"file argument was nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/ipfs/kubo/init.go","lineNumber":90,"sourceCode":"\tNoRemote: true,\n\tExtra:    commands.CreateCmdExtras(commands.SetDoesNotUseRepo(true), commands.SetDoesNotUseConfigAsInput(true)),\n\tPreRun:   commands.DaemonNotRunning,\n\tRun: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tcctx := env.(*oldcmds.Context)\n\t\tempty, _ := req.Options[emptyRepoOptionName].(bool)\n\t\talgorithm, _ := req.Options[algorithmOptionName].(string)\n\t\tnBitsForKeypair, nBitsGiven := req.Options[bitsOptionName].(int)\n\n\t\tvar conf *config.Config\n\n\t\tf := req.Files\n\t\tif f != nil {\n\t\t\tit := req.Files.Entries()\n\t\t\tif !it.Next() {\n\t\t\t\tif it.Err() != nil {\n\t\t\t\t\treturn it.Err()\n\t\t\t\t}\n\t\t\t\treturn errors.New(\"file argument was nil\")\n\t\t\t}\n\t\t\tfile := files.FileFromEntry(it)\n\t\t\tif file == nil {\n\t\t\t\treturn errors.New(\"expected a regular file\")\n\t\t\t}\n\n\t\t\tconf = &config.Config{}\n\t\t\tif err := json.NewDecoder(file).Decode(conf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif conf == nil {\n\t\t\tvar err error\n\t\t\tvar identity config.Identity\n\t\t\tif nBitsGiven {\n\t\t\t\tidentity, err = config.CreateIdentity(os.Stdout, []options.KeyGenerateOption{\n\t\t\t\t\toptions.Key.Size(nBitsForKeypair),","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/cmd/ipfs/kubo/init.go#L72-L108","documentation":"The init command was given file input (req.Files non-nil), but iterating its entries immediately hit EOF with no error, meaning the file list is empty — no configuration file was actually supplied for the custom init.","triggerScenarios":"Thrown at cmd/ipfs/kubo/init.go:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an actual configuration file to 'ipfs init' (e.g. via stdin redirection)","Omit file input entirely to initialize with defaults"],"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"}