{"record":{"id":"aa6248d0c95d7643","repo":"juanfont/headscale","slug":"s-could-not-start-tailscale-container-version","errorCode":null,"errorMessage":"%s could not start tailscale container (version: %s): %w\n\nDocker build failed. Last %d lines of output:\n%s","messagePattern":"(.+?) could not start tailscale container \\(version: (.+?)\\): %w\n\nDocker build failed\\. Last (.+?) lines of output:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"integration/tsic/tsic.go","lineNumber":512,"sourceCode":"\t\t\t\tlog.Printf(\"Docker build failed for %s, attempting to get detailed output...\", hostname)\n\n\t\t\t\tbuildOutput, buildErr := dockertestutil.RunDockerBuildForDiagnostics(dockerContextPath, \"Dockerfile.tailscale-HEAD\")\n\n\t\t\t\t// Show the last 100 lines of build output to avoid overwhelming the logs\n\t\t\t\tlines := strings.Split(buildOutput, \"\\n\")\n\n\t\t\t\tconst maxLines = 100\n\n\t\t\t\tstartLine := 0\n\t\t\t\tif len(lines) > maxLines {\n\t\t\t\t\tstartLine = len(lines) - maxLines\n\t\t\t\t}\n\n\t\t\t\trelevantOutput := strings.Join(lines[startLine:], \"\\n\")\n\n\t\t\t\tif buildErr != nil {\n\t\t\t\t\t// The diagnostic build also failed - this is the real error\n\t\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\t\"%s could not start tailscale container (version: %s): %w\\n\\nDocker build failed. Last %d lines of output:\\n%s\",\n\t\t\t\t\t\thostname,\n\t\t\t\t\t\tversion,\n\t\t\t\t\t\terr,\n\t\t\t\t\t\tmaxLines,\n\t\t\t\t\t\trelevantOutput,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tif buildOutput != \"\" {\n\t\t\t\t\t// Build succeeded on retry but container creation still failed\n\t\t\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\t\t\"%s could not start tailscale container (version: %s): %w\\n\\nDocker build succeeded on retry, but container creation failed. Last %d lines of build output:\\n%s\",\n\t\t\t\t\t\thostname,\n\t\t\t\t\t\tversion,\n\t\t\t\t\t\terr,\n\t\t\t\t\t\tmaxLines,\n\t\t\t\t\t\trelevantOutput,","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/tsic/tsic.go#L494-L530","documentation":"The tailscale HEAD container could not be started, and the diagnostic rebuild of the image also failed — so this error carries the original start failure plus the last 100 lines of Docker build output. It is the terminal, most-informative error of the container bring-up path: the build log tells you why the image cannot be produced.","triggerScenarios":"tsic builds `Dockerfile.tailscale-HEAD` (no prebuilt image, not CI-enforced), the build fails (base image gone, network fetch failure inside build, Dockerfile drift vs current tailscale source), and the retry/diagnostic build also fails.","commonSituations":"Building tailscale HEAD against a moved upstream dependency; build-context path changes; offline environment; Docker BuildKit version incompatibility with the Dockerfile.","solutions":["Read the appended build output — the failing RUN/step is in the last 100 lines.","Reproduce manually: `docker build -f Dockerfile.tailscale-HEAD <context>` to iterate faster.","Avoid the build path entirely by setting HEADSCALE_INTEGRATION_TAILSCALE_IMAGE to a working prebuilt image.","If a base image disappeared upstream, rebuild/pin the base in the Dockerfile."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer a prebuilt image (HEADSCALE_INTEGRATION_TAILSCALE_IMAGE) over building HEAD locally.","Reproduce failing builds with a direct docker build to iterate quickly.","Keep the last-100-lines build log from the error message — it pinpoints the failing step."],"tags":["docker","integration","tailscale","build"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}