{"record":{"id":"0ad7ed348358f86c","repo":"juanfont/headscale","slug":"test-pattern-is-required-as-first-argument-or-use","errorCode":null,"errorMessage":"test pattern is required as first argument or use --test flag","messagePattern":"test pattern is required as first argument or use --test flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/hi/run.go","lineNumber":15,"sourceCode":"package main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/creachadair/command\"\n)\n\nvar ErrTestPatternRequired = errors.New(\"test pattern is required as first argument or use --test flag\")\n\ntype RunConfig struct {\n\tTestPattern   string        `flag:\"test,Test pattern to run\"`\n\tTimeout       time.Duration `flag:\"timeout,default=120m,Test timeout\"`\n\tFailFast      bool          `flag:\"failfast,default=true,Stop on first test failure\"`\n\tUsePostgres   bool          `flag:\"postgres,default=false,Use PostgreSQL instead of SQLite\"`\n\tGoVersion     string        `flag:\"go-version,Go version to use (auto-detected from go.mod)\"`\n\tCleanBefore   bool          `flag:\"clean-before,default=true,Clean stale resources before test\"`\n\tCleanAfter    bool          `flag:\"clean-after,default=true,Clean resources after test\"`\n\tKeepOnFailure bool          `flag:\"keep-on-failure,default=false,Keep containers on test failure\"`\n\tLogsDir       string        `flag:\"logs-dir,default=control_logs,Control logs directory\"`\n\tVerbose       bool          `flag:\"verbose,default=false,Verbose output\"`\n\tStats         bool          `flag:\"stats,default=false,Collect and display container resource usage statistics\"`\n\tHSMemoryLimit float64       `flag:\"hs-memory-limit,default=0,Fail test if any Headscale container exceeds this memory limit in MB (0 = disabled)\"`\n\tTSMemoryLimit float64       `flag:\"ts-memory-limit,default=0,Fail test if any Tailscale container exceeds this memory limit in MB (0 = disabled)\"`\n}\n\n// runIntegrationTest executes the integration test workflow.","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/hi/run.go#L1-L33","documentation":"Wrapped error from doLoginURLWithClient when hc.Do(req) fails: the login GET request could not be completed. Covers connection refused, DNS failure, TLS errors, redirects failing, and context cancellation. The hostname prefix says which node's login flow broke.","triggerScenarios":"OIDC login against a login URL whose host is unreachable from the test process — headscale/OIDC provider container not listening, wrong hostname resolution, TLS certificate mismatch, or connection reset mid-request.","commonSituations":"Headscale container restarted between URL issuance and the GET, Docker network DNS flakiness, OIDC provider (e.g. dex) not yet ready, or the control server URL using a hostname only resolvable inside the Docker network.","solutions":["Read the wrapped error: 'connection refused' means the target is not listening — check container status and port mapping.","curl the login URL from the host to verify reachability and TLS.","Ensure the OIDC provider container is healthy before starting the login flow.","Re-run; transient Docker networking resets are common in CI."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// cheap reachability check before the login GET\nconn, err := net.DialTimeout(\"tcp\", loginURL.Host, 2*time.Second)\nif err != nil {\n    return fmt.Errorf(\"login target unreachable: %w\", err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"resp, redir, err := doLoginURLWithClient(hostname, loginURL, hc, true)\nif err != nil {\n    if strings.Contains(err.Error(), \"sending http request\") {\n        var netErr net.Error\n        if errors.As(err, &netErr) && netErr.Timeout() {\n            // retry once after a short backoff\n        }\n    }\n}","preventionTips":["Ensure headscale and the OIDC provider containers are healthy before login flows.","Use host-resolvable server_url values in test configs.","Retain full wrapped errors (never replace %w chains) so transport causes stay visible."],"tags":["integration","http","network","oidc","login"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}