{"record":{"id":"0318bf6f5437c723","repo":"hashicorp/nomad","slug":"failed-to-create-secrets-s-w","errorCode":null,"errorMessage":"failed to create secrets/%s: %w","messagePattern":"failed to create secrets/(.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/connect_native_hook.go","lineNumber":160,"sourceCode":"\t}\n\treturn nil\n}\n\nfunc (connectNativeHook) copyCertificate(source, dir, name string) error {\n\tif source == \"\" {\n\t\treturn nil\n\t}\n\n\toriginal, err := os.Open(source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open consul TLS certificate: %w\", err)\n\t}\n\tdefer original.Close()\n\n\tdestination := filepath.Join(dir, name)\n\tfd, err := os.Create(destination)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create secrets/%s: %w\", name, err)\n\t}\n\tdefer fd.Close()\n\n\tif _, err := io.Copy(fd, original); err != nil {\n\t\treturn fmt.Errorf(\"failed to copy certificate secrets/%s: %w\", name, err)\n\t}\n\n\tif err := fd.Sync(); err != nil {\n\t\treturn fmt.Errorf(\"failed to write secrets/%s: %w\", name, err)\n\t}\n\n\treturn nil\n}\n\n// tlsEnv creates a set of additional of environment variables to be used when launching\n// the connect native task. This will enable the task to communicate with Consul\n// if Consul has transport security turned on.\n//","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/connect_native_hook.go#L142-L178","documentation":"copyCertificate failed creating the destination file under the task's secrets/ directory (os.Create error), typically due to directory permissions or a read-only filesystem, aborting TLS certificate setup for Connect Native tasks.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/connect_native_hook.go:160 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check secrets dir permissions in the task's alloc dir","Verify the alloc dir filesystem is writable and not full","Restart the allocation to recreate the secrets directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}