{"record":{"id":"f938116108c4c0de","repo":"dagger/dagger","slug":"path-q-does-not-exist-in-git-repo","errorCode":null,"errorMessage":"path %q does not exist in git repo","messagePattern":"path %q does not exist in git repo","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/modulesource.go","lineNumber":727,"sourceCode":"\t\t}\n\t\tif !found {\n\t\t\tif !allowNotExists {\n\t\t\t\treturn \"\", false, fmt.Errorf(\"git module source %q does not contain a dagger config file\", gitSrc.AsString())\n\t\t\t}\n\t\t\treturn \"\", false, nil\n\t\t}\n\t\tgitSrc.ConfigFilename = configFilename\n\t\treturn filepath.Join(gitSrc.SourceRootSubpath, configFilename), true, nil\n\t}\n\n\t// first validate the given path exists at all, otherwise weird things like\n\t// `dagger -m github.com/dagger/dagger/not/a/real/dir` can succeed because\n\t// they find-up to a real module config file\n\tif gitSrc.SourceRootSubpath != \"\" {\n\t\tif _, exists, err := core.StatFSExists(ctx, statFS, gitSrc.SourceRootSubpath); err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"failed to stat git module source: %w\", err)\n\t\t} else if !exists {\n\t\t\treturn \"\", false, fmt.Errorf(\"path %q does not exist in git repo\", gitSrc.SourceRootSubpath)\n\t\t}\n\t}\n\n\tconfigDir, configFilename, found, err := findUpModuleConfig(ctx, statFS, filepath.Join(\"/\", gitSrc.SourceRootSubpath))\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"failed to find-up module config: %w\", err)\n\t}\n\tif !found {\n\t\tif !allowNotExists {\n\t\t\treturn \"\", false, fmt.Errorf(\"git module source %q does not contain a dagger config file\", gitSrc.AsString())\n\t\t}\n\t\treturn \"\", false, nil\n\t}\n\tgitSrc.ConfigFilename = configFilename\n\tgitSrc.SourceRootSubpath = strings.TrimPrefix(configDir, \"/\")\n\treturn filepath.Join(configDir, configFilename), true, nil\n}\n","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/modulesource.go#L709-L745","documentation":"Thrown by findGitModuleConfig when the explicitly given SourceRootSubpath does not exist inside the fetched git repo. This pre-existence check exists so that a wrong subpath cannot find-up to some unrelated module config elsewhere in the repo and appear to succeed.","triggerScenarios":"`dagger -m github.com/org/repo/not/a/real/dir` (or any misspelled subpath) — the subpath string is non-empty and core.StatFSExists reports it absent in the loaded git tree.","commonSituations":"Typo in the -m path; path exists on another branch/tag than the one resolved; path renamed or deleted at the pinned ref; using a directory that only exists locally but not in the repo.","solutions":["Correct the subpath in the module reference to a directory that exists at the resolved ref","Verify the path exists at that ref/tag/branch in the git host UI","Check whether a pin (version/ref) points at an older commit where the path didn't exist","If the module lives at the repo root, drop the subpath entirely"],"exampleFix":"// before\ndagger -m github.com/dagger/dagger/modules/notreal\n// after\ndagger -m github.com/dagger/dagger/modules/go","handlingStrategy":"validation","validationCode":"// Assert the subpath exists in the repo at the target ref first\nconst exists = await client.git(repoUrl).ref(ref).tree().directory(subpath)\n  .file(\"dagger.json\").exists ? true : true; // use .id() to force resolution\nawait client.git(repoUrl).ref(ref).tree().directory(subpath).id();","typeGuard":null,"tryCatchPattern":"try {\n  await client.moduleSource(`${repoUrl}/${subpath}`).load();\n} catch (e) {\n  if (String(e).includes(\"does not exist in git repo\")) {\n    // fix subpath or ref before retrying\n  }\n  throw e;\n}","preventionTips":["Double-check subpath spelling in the -m argument","Verify the path exists at the exact ref/commit being resolved (not another branch)","Don't rely on find-up for nonexistent paths — dagger explicitly blocks it","Use repo-relative paths exactly as they appear in git"],"tags":["git","path-not-found","module-reference"],"backgroundTag":"git-subpath-not-found","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"}