{"record":{"id":"d6ed4930e33b708f","repo":"dagger/dagger","slug":"failed-to-get-relative-path-from-context-to-dep","errorCode":null,"errorMessage":"failed to get relative path from context to dep: %w","messagePattern":"failed to get relative path from context to dep: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/modulesource.go","lineNumber":2182,"sourceCode":"\t\t\t\t})\n\t\t\t}\n\t\t\tif err := dag.Select(ctx, parentSrc.Workspace, &inst, selectors...); err != nil {\n\t\t\t\tif errors.Is(err, dagql.ErrCacheRecursiveCall) {\n\t\t\t\t\treturn inst, fmt.Errorf(\"module %q has a circular dependency on itself through dependency %q\", parentSrc.ModuleName, depName)\n\t\t\t\t}\n\t\t\t\treturn inst, err\n\t\t\t}\n\t\t\treturn inst, nil\n\t\t}\n\n\t\tswitch parentSrc.Kind {\n\t\tcase ModuleSourceKindLocal:\n\t\t\t// parent=local, dep=local\n\t\t\t// load the dep relative to the parent's source root, from the caller's filesystem\n\t\t\tdepPath := filepath.Join(parentSrc.Local.ContextDirectoryPath, parentSrc.SourceRootSubpath, depSrcRef)\n\t\t\tdepRelPath, err := pathutil.LexicalRelativePath(parentSrc.Local.ContextDirectoryPath, depPath)\n\t\t\tif err != nil {\n\t\t\t\treturn inst, fmt.Errorf(\"failed to get relative path from context to dep: %w\", err)\n\t\t\t}\n\t\t\tif !filepath.IsLocal(depRelPath) {\n\t\t\t\treturn inst, fmt.Errorf(\"local module dep source path %q escapes context %q\", depRelPath, parentSrc.Local.ContextDirectoryPath)\n\t\t\t}\n\n\t\t\tselectors := []dagql.Selector{{\n\t\t\t\tField: \"moduleSource\",\n\t\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t\t{Name: \"refString\", Value: dagql.String(depPath)},\n\t\t\t\t\t{Name: \"disableFindUp\", Value: dagql.Boolean(true)},\n\t\t\t\t},\n\t\t\t}}\n\t\t\tif depName != \"\" {\n\t\t\t\tselectors = append(selectors, dagql.Selector{\n\t\t\t\t\tField: \"withName\",\n\t\t\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t\t\t{Name: \"name\", Value: dagql.String(depName)},\n\t\t\t\t\t},","sourceCodeStart":2164,"sourceCodeEnd":2200,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/modulesource.go#L2164-L2200","documentation":"For a local parent and local dependency, Dagger joins the parent's context directory, source root, and dep path, then computes the lexical relative path from the context directory to the dep. pathutil.LexicalRelativePath failed, so no relative representation exists — typically when the paths are on different drives/volumes or otherwise cannot be related lexically.","triggerScenarios":"ResolveDepToSource with parent local and dep local where LexicalRelativePath(contextDirectoryPath, depPath) errors — most commonly Windows paths on different drive letters (C:\\ctx vs D:\\dep) or malformed absolute paths mixed into the join.","commonSituations":"Windows users placing the dependency on another drive; context directory paths produced from different mount points (WSL vs Windows paths); corrupted context paths from custom Directory inputs.","solutions":["Put the dependency module on the same drive/volume as the parent module's context directory (Windows).","Run from within the repository so context and dep share a common root; avoid mixing WSL (\\\\wsl$) and Windows paths.","Check that the parent's Local.ContextDirectoryPath is a valid absolute path in the expected form.","If using custom directory inputs, ensure the dep path stays under that directory so a relative path exists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"depPath := filepath.Join(parentSrc.Local.ContextDirectoryPath, parentSrc.SourceRootSubpath, depRef)\nif _, err := pathutil.LexicalRelativePath(parentSrc.Local.ContextDirectoryPath, depPath); err != nil {\n    return fmt.Errorf(\"dep %q cannot be made relative to context (different drive/root?): %v\", depRef, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On Windows keep modules and deps on the same drive letter.","Avoid mixing WSL and Windows path styles in one project.","Ensure context directory paths are canonical absolute paths.","Keep deps inside the repo so a lexical relative path always exists."],"tags":["dagger","modules","path","windows"],"backgroundTag":"no-relative-path-between-paths","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"}