{"record":{"id":"406e65d8c146f9f4","repo":"dagger/dagger","slug":"get-parent-name-w","errorCode":null,"errorMessage":"get parent name: %w","messagePattern":"get parent name: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/codegen/generator/go/templates/modules.go","lineNumber":261,"sourceCode":"\tdefer telemetry.Close()\n\n\t// A lot of the \"work\" actually happens when we're marshalling the return\n\t// value, which entails getting object IDs, which happens in MarshalJSON,\n\t// which has no ctx argument, so we use this lovely global variable.\n\tsetMarshalContext(ctx)\n\n\tfnCall := dag.CurrentFunctionCall()\n\tdefer func() {\n\t\tif rerr != nil {\n\t\t\tif ` + voidRet + ` := fnCall.ReturnError(ctx, convertError(rerr)); err != nil {\n\t\t\t\tfmt.Println(\"failed to return error:\", err, \"\\noriginal error:\", rerr)\n\t\t\t}\n\t\t}\n\t}()\n\n\tparentName, err := fnCall.ParentName(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get parent name: %w\", err)\n\t}\n\tfnName, err := fnCall.Name(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get fn name: %w\", err)\n\t}\n\tparentJson, err := fnCall.Parent(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get fn parent: %w\", err)\n\t}\n\tfnArgs, err := fnCall.InputArgs(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get fn args: %w\", err)\n\t}\n\n\tinputArgs := map[string][]byte{}\n\tfor _, fnArg := range fnArgs {\n\t\targName, err := fnArg.Name(ctx)\n\t\tif err != nil {","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/cmd/codegen/generator/go/templates/modules.go#L243-L279","documentation":"This error comes from the generated main.go runtime of a Dagger Go module (the code the SDK generates for the module's entrypoint). dispatch() first asks the engine for the name of the parent object of the current function call via fnCall.ParentName(ctx); if that engine query fails, the error is wrapped as 'get parent name'. The failure is reported back to the engine via fnCall.ReturnError.","triggerScenarios":"Executing a module function when the CurrentFunctionCall query to the Dagger engine fails or returns an error for ParentName — e.g. the invocation context is missing/corrupt (not run under `dagger call`), engine connection drops mid-call, or engine/SDK version skew makes the API field unavailable.","commonSituations":"Running the generated binary directly outside the dagger CLI without the call metadata; engine restarting/OOM during a call; mismatched dagger CLI vs SDK versions after upgrade; network/uds issues between module runtime and engine.","solutions":["Re-run the function through `dagger call` / `dagger run` so proper call metadata is provided to the runtime","Check engine health (`dagger query` works) and restart the engine if the session dropped","Align dagger CLI and Go SDK versions (re-run `dagger develop` after upgrading the CLI)","Inspect the wrapped %w cause for the underlying GraphQL/transport error and act on it (e.g. connection refused -> ensure engine is running)"],"exampleFix":"// before\n$ ./dagger/main  # run directly, no engine metadata\n\n// after\n$ dagger -m ./dagger call my-function","handlingStrategy":"try-catch","validationCode":"// ensure the runtime is invoked inside a dagger session\nif os.Getenv(\"DAGGER_SESSION_PORT\") == \"\" && os.Getenv(\"_EXPERIMENTAL_DAGGER_CLI_BIN\") == \"\" {\n\tlog.Fatal(\"module runtime must be started via dagger call/run, not directly\")\n}","typeGuard":null,"tryCatchPattern":"// in module code, errors are reported back to the engine automatically;\n// verify by running and inspecting the returned error:\n//   out, err := dag.Module().MyFn(ctx)\n//   if err != nil { /* strings.Contains(err.Error(), \"get parent name\") */ }","preventionTips":["Always invoke module functions via `dagger call` or `dagger run`, never the generated binary directly","Keep CLI and SDK versions aligned; re-run `dagger develop` after upgrading","Check engine health (`dagger query`) when calls fail with engine metadata errors"],"tags":["dagger","runtime","engine","go-sdk"],"backgroundTag":"engine-call-metadata-unavailable","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}