{"record":{"id":"85e7687207cb6174","repo":"dagger/dagger","slug":"url-must-start-with-http-or-https","errorCode":null,"errorMessage":"URL must start with http:// or https://","messagePattern":"URL must start with http:// or https://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/llmconfig/setup.go","lineNumber":864,"sourceCode":"\tvar endpoint string\n\tform := huh.NewForm(\n\t\thuh.NewGroup(\n\t\t\thuh.NewInput().\n\t\t\t\tTitle(\"Endpoint URL\").\n\t\t\t\tDescription(\"The base URL of your local LLM server (e.g. http://192.168.2.225:1234).\").\n\t\t\t\tPlaceholder(\"http://localhost:11434\").\n\t\t\t\tValue(&endpoint).\n\t\t\t\tValidate(func(s string) error {\n\t\t\t\t\ts = strings.TrimSpace(s)\n\t\t\t\t\tif s == \"\" {\n\t\t\t\t\t\treturn fmt.Errorf(\"endpoint URL is required\")\n\t\t\t\t\t}\n\t\t\t\t\tu, err := url.Parse(s)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"invalid URL: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t\tif u.Scheme != \"http\" && u.Scheme != \"https\" {\n\t\t\t\t\t\treturn fmt.Errorf(\"URL must start with http:// or https://\")\n\t\t\t\t\t}\n\t\t\t\t\tif u.Host == \"\" {\n\t\t\t\t\t\treturn fmt.Errorf(\"URL must include a host\")\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t}),\n\t\t),\n\t)\n\tif err := checkAbort(ph.HandleForm(ctx, form)); err != nil {\n\t\treturn \"\", nil, \"\", err\n\t}\n\tendpoint = strings.TrimSpace(endpoint)\n\t// Strip trailing slash for consistency\n\tendpoint = strings.TrimRight(endpoint, \"/\")\n\n\tvar compat string\n\tcompatForm := huh.NewForm(\n\t\thuh.NewGroup(","sourceCodeStart":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/llmconfig/setup.go#L846-L882","documentation":"Form validation error requiring the endpoint URL scheme to be http or https. The library throws it when the parsed URL has a different or missing scheme, since custom LLM servers must be reached over HTTP(S).","triggerScenarios":"Submitting the endpoint form with values like \"localhost:11434\", \"192.168.2.225:1234\", \"ftp://...\", or \"unix:///path\" — anything without an explicit http:// or https:// prefix.","commonSituations":"User omits the scheme because browsers tolerate it; copying a host:port pair from docs without the prefix; assuming a default scheme is applied.","solutions":["Prefix the endpoint with http:// (or https:// for TLS): http://localhost:11434.","Do not use unix:// or other schemes; the client speaks HTTP only.","If your server is plain HTTP on localhost, http:// is correct — https is not required locally."],"exampleFix":"// before\nEndpoint: \"localhost:11434\"\n// after\nEndpoint: \"http://localhost:11434\"","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(strings.TrimSpace(endpoint))\nif u.Scheme != \"http\" && u.Scheme != \"https\" {\n    return fmt.Errorf(\"URL must start with http:// or https://\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always prefix host:port with http:// or https://.","Do not assume a default scheme is added.","Avoid non-HTTP schemes (unix://, ftp://)."],"tags":["validation","url","scheme","tui"],"backgroundTag":"invalid-url-scheme","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"}