{"record":{"id":"1bffb070100377e8","repo":"juanfont/headscale","slug":"writing-tls-certificate-to-container-w","errorCode":null,"errorMessage":"writing TLS certificate to container: %w","messagePattern":"writing TLS certificate to container: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/dsic/dsic.go","lineNumber":268,"sourceCode":"\t\tdockertestutil.DockerAllowNetworkAdministration,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"%s starting tailscale DERPer container (version: %s): %w\",\n\t\t\thostname,\n\t\t\tversion,\n\t\t\terr,\n\t\t)\n\t}\n\n\tlog.Printf(\"Created %s container\\n\", hostname)\n\n\tdsic.container = container\n\n\tfor i, cert := range dsic.caCerts {\n\t\terr = dsic.WriteFile(fmt.Sprintf(\"%s/user-%d.crt\", caCertRoot, i), cert)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"writing TLS certificate to container: %w\", err)\n\t\t}\n\t}\n\n\tif len(dsic.tlsCert) != 0 {\n\t\terr = dsic.WriteFile(fmt.Sprintf(\"%s/%s.crt\", DERPerCertRoot, dsic.hostname), dsic.tlsCert)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"writing TLS certificate to container: %w\", err)\n\t\t}\n\t}\n\n\tif len(dsic.tlsKey) != 0 {\n\t\terr = dsic.WriteFile(fmt.Sprintf(\"%s/%s.key\", DERPerCertRoot, dsic.hostname), dsic.tlsKey)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"writing TLS key to container: %w\", err)\n\t\t}\n\t}\n\n\treturn dsic, nil","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/dsic/dsic.go#L250-L286","documentation":"Returned by the DERP integration-test helper when writing a CA certificate (user-<i>.crt under caCertRoot) into the running DERPer container fails via the container exec helper WriteFile. It wraps the copy/exec error.","triggerScenarios":"After the DERPer container starts, dsic writes each extra CA cert into it; failure occurs if the target directory does not exist in the container, the exec fails, or the container exited between start and write.","commonSituations":"DERPer container crashes immediately on startup (bad flags/version mismatch), image layout changed between tailscale versions so /usr/local/share/ca-certificates is absent, or Docker exec errors under load.","solutions":["Inspect the DERPer container logs (SaveLog output under control_logs) to see if it crashed right after start","Pin/verify the tailscale DERPer image version matches what the test expects","Re-run once to rule out transient Docker exec failures"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check DERPer container logs immediately when cert writes fail — it usually crashed on start","Keep test tailscale/DERPer image versions aligned with the paths the helper writes to"],"tags":["integration-test","docker","tls","derp"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}