{"record":{"id":"891046384bff41d9","repo":"dagger/dagger","slug":"failed-to-parse-ref-string-w","errorCode":null,"errorMessage":"failed to parse ref string: %w","messagePattern":"failed to parse ref string: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/modulerefs.go","lineNumber":110,"sourceCode":"\n\t// Parse scheme and attempt to parse as git endpoint\n\tparsedGitRef, err := ParseGitRefString(ctx, refString)\n\tswitch {\n\tcase err == nil:\n\t\treturn &ParsedRefString{\n\t\t\tKind: ModuleSourceKindGit,\n\t\t\tGit:  &parsedGitRef,\n\t\t}, nil\n\tcase errors.As(err, &gitref.EndpointError{}):\n\t\t// couldn't connect to git endpoint, fallback to local\n\t\treturn &ParsedRefString{\n\t\t\tKind: ModuleSourceKindLocal,\n\t\t\tLocal: &ParsedLocalRefString{\n\t\t\t\tModPath: refString,\n\t\t\t},\n\t\t}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"failed to parse ref string: %w\", err)\n\t}\n}\n\ntype ParsedLocalRefString struct {\n\tModPath string\n}\n\n// ParsedGitRefString pairs the pure parsed git-ref data (gitref.Parsed) with\n// the dagql-aware GitRef resolution that needs the engine schema.\ntype ParsedGitRefString struct {\n\tgitref.Parsed\n}\n\nfunc ParseGitRefString(ctx context.Context, refString string) (ParsedGitRefString, error) {\n\tparsed, err := gitref.Parse(ctx, refString)\n\treturn ParsedGitRefString{parsed}, err\n}\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/modulerefs.go#L92-L128","documentation":"ParseRefString could not classify a module ref string as local or git. The fast path check failed, the path did not exist as a local directory, and ParseGitRefString failed with a non-endpoint error, so Dagger cannot determine what the ref string refers to.","triggerScenarios":"Calling dagger with a module ref string (e.g. in `dagger mod use` or `dagger call --mod`) that is neither an existing local directory nor a parseable git URL — e.g. a typo'd path, a malformed git URL with a bad scheme, or a ref that hits a parse error rather than a connection error.","commonSituations":"Typos in module paths, referencing a module by shorthand when cwd is not the module root, malformed git URLs (e.g. 'git@...' forms or missing scheme) that fail parsing instead of endpoint resolution.","solutions":["Check the ref string for typos and use the correct format: a local directory path or a full git URL like https://github.com/org/repo","If it is a local module, run from (or pass a path to) the directory containing dagger.json","If it is a git module, verify the clone URL parses as a valid git endpoint and test `git ls-remote <url>`","Check dagger version; ref parsing rules changed across releases, so upgrade if the ref format is documented for a newer CLI"],"exampleFix":"// before\ndagger call --mod github.com/org/repo/subdir fn\n// after (correct git ref format with scheme)\ndagger call --mod https://github.com/org/repo fn","handlingStrategy":"validation","validationCode":"// Go: check ref before calling dagger\nfunc validModuleRef(ref string) bool {\n\tif st, err := os.Stat(ref); err == nil && st.IsDir() {\n\t\treturn true\n\t}\n\treturn strings.HasPrefix(ref, \"https://\") || strings.HasPrefix(ref, \"http://\")\n}","typeGuard":"if _, err := os.Stat(ref); err == nil && isGitURL(ref) { /* ambiguous: prefer explicit local ./ prefix */ }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to parse ref string\") {\n\treturn fmt.Errorf(\"module ref %q is neither a local dir nor a valid git URL\", ref)\n}","preventionTips":["Prefix local module refs with ./ to force local interpretation","Always use full https:// git URLs for remote modules","Test module install commands from the intended working directory"],"tags":["dagger","module-source","parsing","git"],"backgroundTag":"invalid-module-ref-string","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"}