{"record":{"id":"ae3fa6b848ad83bd","repo":"dagger/dagger","slug":"failed-to-get-module-source-id-w-ae3fa6","errorCode":null,"errorMessage":"failed to get module source id: %w","messagePattern":"failed to get module source id: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/typescript/runtime/main.go","lineNumber":177,"sourceCode":"\t}\n}\n\n// Returns a directory with a standalone generated client and any necessary configuration\n// files that are required to work.\nfunc (t *TypescriptSdk) GenerateClient(\n\tctx context.Context,\n\tmodSource *dagger.ModuleSource,\n\tintrospectionJSON *dagger.File,\n\toutputDir string,\n) (*dagger.Directory, error) {\n\tcfg, err := analyzeClientConfig(ctx, modSource)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to analyze module config: %w\", err)\n\t}\n\n\tmoduleSourceID, err := modSource.ID(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get module source id: %w\", err)\n\t}\n\n\tresult := dag.Directory()\n\n\tlibGenerator := NewLibGenerator(t.SDKSourceDir, &LibGeneratorOpts{\n\t\tmoduleSourceID:    string(moduleSourceID),\n\t\tgenClient:         true,\n\t\tcoexistWithModule: cfg.sdk != \"\" && cfg.subPath == \".\",\n\t})\n\n\tif cfg.sdkLibOrigin == Remote {\n\t\t// Include every generated binding: client.gen.ts plus the per-dependency\n\t\t// <dep>.gen.ts files it imports via relative \"./<dep>.gen.js\" paths.\n\t\tresult = result.WithDirectory(\n\t\t\toutputDir,\n\t\t\tlibGenerator.GenerateRemoteLibrary(introspectionJSON, outputDir),\n\t\t\tdagger.DirectoryWithDirectoryOpts{\n\t\t\t\tInclude: []string{\"*.gen.ts\"},","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/typescript/runtime/main.go#L159-L195","documentation":"GenerateClient fetches modSource.ID(ctx) to obtain a stable content-addressed identifier of the module source, which is passed into the LibGenerator for generating the client bindings. If that Dagger API call fails, the error is wrapped as \"failed to get module source id\". It means the engine could not resolve the ModuleSource into an ID — usually an engine-side problem with the source context.","triggerScenarios":"Calling GenerateClient when ModuleSource.ID(ctx) errors: the source context directory is unavailable, engine evaluation of the source fails, or the session/context is cancelled mid-call.","commonSituations":"Running client generation against a module whose git/context directory cannot be resolved by the engine (e.g. dirty git state with unresolved refs, remote git source fetch failures, or engine storage issues).","solutions":["Re-run the generation command; many causes are transient.","Run with `dagger --debug` to see the underlying engine error.","If the source is a remote git ref, verify it is reachable and the commit/ref exists locally.","Restart the Dagger engine (`dagger engine stop` then retry) if errors persist."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure the module source context resolves locally before generation:\nif (isRemoteGitSource) { run('git ls-remote ' + url + ' ' + ref) } // verifies ref is reachable\ngit status --porcelain // verify clean, resolvable working tree","typeGuard":null,"tryCatchPattern":"moduleSourceID, err := modSource.ID(ctx)\nif err != nil {\n    return nil, fmt.Errorf(\"failed to get module source id: %w\", err) // retry transient engine failures\n}","preventionTips":["Retry the generation command once on failure.","For remote git sources, verify the ref/commit is reachable.","Restart the engine if ID resolution fails repeatedly.","Keep large binaries/untracked noise out of the module context."],"tags":["dagger","typescript-sdk","client-generation","engine"],"backgroundTag":"dagger-engine-error","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"}