{"record":{"id":"3bbf16a0def777c8","repo":"juanfont/headscale","slug":"restarting-container-s-w","errorCode":null,"errorMessage":"restarting container %s: %w","messagePattern":"restarting container (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/tsic/tsic.go","lineNumber":788,"sourceCode":"\t\treturn fmt.Errorf(\"logging out, stdout: %s, stderr: %s\", stdout, stderr) //nolint:err113\n\t}\n\n\treturn t.waitForBackendState(\"NeedsLogin\", integrationutil.PeerSyncTimeout())\n}\n\n// Restart restarts the Tailscale container using Docker API.\n// This simulates a container restart (e.g., docker restart or Kubernetes pod restart).\n// The container's entrypoint will re-execute, which typically includes running\n// \"tailscale up\" with any auth keys stored in environment variables.\nfunc (t *TailscaleInContainer) Restart() error {\n\tif t.container == nil {\n\t\treturn errContainerNotInitialized\n\t}\n\n\t// Use Docker API to restart the container\n\terr := t.pool.Client.RestartContainer(t.container.Container.ID, 30)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"restarting container %s: %w\", t.hostname, err)\n\t}\n\n\t// Wait for the container to be back up and tailscaled to be ready\n\t// We use exponential backoff to poll until we can successfully execute a command\n\t_, err = backoff.Retry(context.Background(), func() (struct{}, error) {\n\t\t// Try to execute a simple command to verify the container is responsive\n\t\t_, _, err := t.Execute([]string{tailscaleBin, \"version\"}, dockertestutil.ExecuteCommandTimeout(5*time.Second))\n\t\tif err != nil {\n\t\t\treturn struct{}{}, fmt.Errorf(\"container not ready: %w\", err)\n\t\t}\n\n\t\treturn struct{}{}, nil\n\t}, backoff.WithBackOff(backoff.NewExponentialBackOff()), backoff.WithMaxElapsedTime(30*time.Second))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"timeout waiting for container %s to restart and become ready: %w\", t.hostname, err)\n\t}\n\n\treturn nil","sourceCodeStart":770,"sourceCodeEnd":806,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/tsic/tsic.go#L770-L806","documentation":"Error \"restarting container %s: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at integration/tsic/tsic.go:788 when the library encounters an invalid state.","commonSituations":"Restarting the tailscale container failed. Check Docker daemon health and container state.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (restarting container); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (restarting container); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}