{"record":{"id":"3a806f0ea055a93c","repo":"ipfs/kubo","slug":"constructing-the-node-see-log-for-full-detail","errorCode":null,"errorMessage":"constructing the node (see log for full detail): %w","messagePattern":"constructing the node \\(see log for full detail\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/builder.go","lineNumber":189,"sourceCode":"\n\terr := fxAppErr\n\tfor {\n\t\textractedErr := dig.RootCause(err)\n\t\t// Note that the `RootCause` name is misleading as it just unwraps only\n\t\t// *one* error layer at a time, so we need to continuously call it.\n\t\tif !reflect.TypeOf(extractedErr).Comparable() {\n\t\t\t// Some internal errors are not comparable (e.g., `dig.errMissingTypes`\n\t\t\t// which is a slice) and we can't go further.\n\t\t\tbreak\n\t\t}\n\t\tif extractedErr == err {\n\t\t\t// We didn't unwrap any new error in the last call, reached the innermost one.\n\t\t\tbreak\n\t\t}\n\t\terr = extractedErr\n\t}\n\n\treturn fmt.Errorf(\"constructing the node (see log for full detail): %w\", err)\n}\n","sourceCodeStart":171,"sourceCodeEnd":191,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/builder.go#L171-L191","documentation":"When fx fails to construct the node, NewNode delegates to logAndUnwrapFxError, which iteratively unwraps fx's InternalError/extracted errors to reach the innermost root cause, logs the full detail, and returns it wrapped as 'constructing the node (see log for full detail)'. It signals that an fx-provided dependency (e.g. blockservice, pnet, routing) failed during graph construction.","triggerScenarios":"core.NewNode reaching fx.New(opts...) and the fx app failing to build — e.g. a constructor returning an error (bad private network key, datastore open failure, invalid config value consumed by a constructor).","commonSituations":"Daemon startup failure due to corrupted repo, swarm key mismatch (pnet), or invalid config consumed by a service constructor; library users constructing online nodes on machines with missing resources.","solutions":["Check the node logs — the real error was logged with full detail before this wrapper is returned.","Unwrap with errors.Unwrap repeatedly (the function already does this; inspect the final cause with `%+v`).","Fix the underlying dependency failure: verify repo/datastore, swarm.key, and config values.","Rebuild/restart; if caused by a plugin, disable the offending plugin."],"exampleFix":"// before\nn, err := core.NewNode(ctx, cfg)\nif err != nil { return err } // opaque\n// after\nif err != nil {\n    for e := err; e != nil; e = errors.Unwrap(e) {\n        fmt.Println(e) // find innermost cause\n    }\n}","handlingStrategy":"try-catch","validationCode":"// validate config parseable before node build\nvar cfg config.Config\nif err := json.Unmarshal(cfgBytes, &cfg); err != nil {\n    return fmt.Errorf(\"invalid config: %w\", err)\n}","typeGuard":"func isNodeConstructionError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"constructing the node\")\n}","tryCatchPattern":"n, err := core.NewNode(ctx, cfg)\nif err != nil && isNodeConstructionError(err) {\n    // full detail is in the node log; also walk the unwrap chain\n    for e := err; e != nil; e = errors.Unwrap(e) {\n        log.Println(e)\n    }\n    cancel()\n    return err\n}","preventionTips":["Always capture node logs at debug/error level during startup — the root cause is logged there","Validate swarm.key and repo permissions before starting private-network nodes","Test node construction in CI with a throwaway IPFS_PATH"],"tags":["node-construction","dependency-injection","fx"],"backgroundTag":"node-initialization-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"}