{"record":{"id":"5095a546d85df291","repo":"slackhq/nebula","slug":"erremptyrawdetails","errorCode":"ErrEmptyRawDetails","errorMessage":"empty rawDetails not allowed","messagePattern":"empty rawDetails not allowed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cert/errors.go","lineNumber":39,"sourceCode":"\tErrPrivateKeyEncrypted        = errors.New(\"private key must be decrypted\")\n\tErrCaNotFound                 = errors.New(\"could not find ca for the certificate\")\n\tErrUnknownVersion             = errors.New(\"certificate version unrecognized\")\n\tErrCertPubkeyPresent          = errors.New(\"certificate has unexpected pubkey present\")\n\tErrCurveMismatch              = errors.New(\"certificate curve does not match CA\")\n\n\tErrInvalidPEMBlock                   = errors.New(\"input did not contain a valid PEM encoded block\")\n\tErrInvalidPEMCertificateBanner       = errors.New(\"bytes did not contain a proper certificate banner\")\n\tErrInvalidPEMX25519PublicKeyBanner   = errors.New(\"bytes did not contain a proper X25519 public key banner\")\n\tErrInvalidPEMX25519PrivateKeyBanner  = errors.New(\"bytes did not contain a proper X25519 private key banner\")\n\tErrInvalidPEMEd25519PublicKeyBanner  = errors.New(\"bytes did not contain a proper Ed25519 public key banner\")\n\tErrInvalidPEMEd25519PrivateKeyBanner = errors.New(\"bytes did not contain a proper Ed25519 private key banner\")\n\n\tErrNoPeerStaticKey = errors.New(\"no peer static key was present\")\n\tErrNoPayload       = errors.New(\"provided payload was empty\")\n\n\tErrMissingDetails  = errors.New(\"certificate did not contain details\")\n\tErrEmptySignature  = errors.New(\"empty signature\")\n\tErrEmptyRawDetails = errors.New(\"empty rawDetails not allowed\")\n)\n\ntype ErrInvalidCertificateProperties struct {\n\tstr string\n}\n\nfunc NewErrInvalidCertificateProperties(format string, a ...any) error {\n\treturn &ErrInvalidCertificateProperties{fmt.Sprintf(format, a...)}\n}\n\nfunc (e *ErrInvalidCertificateProperties) Error() string {\n\treturn e.str\n}\n","sourceCodeStart":21,"sourceCodeEnd":53,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/cert/errors.go#L21-L53","documentation":"ErrEmptyRawDetails is returned by certificateV2's Marshal and MarshalForHandshakes when rawDetails is nil. Marshalling serializes the stored raw details into the wire format; without them there is nothing to encode, so both methods fail fast.","triggerScenarios":"Calling MarshalForHandshakes() or Marshal() on a certificateV2 whose rawDetails is nil — e.g. a zero-value certificate, or one deserialized from input lacking the details section.","commonSituations":"Constructing a certificateV2 by hand in tests/tools without setting rawDetails; truncated or corrupt certificate bytes dropping the details field; calling Marshal before the certificate is fully initialized.","solutions":["Populate rawDetails (e.g. via details.Marshal() or the normal construction path) before calling Marshal/MarshalForHandshakes","Check that the certificate was built through the library constructor rather than as a bare struct literal","Validate the source certificate bytes were parsed completely before marshalling"],"exampleFix":"// before\nc := &certificateV2{}\nb, err := c.Marshal() // rawDetails nil\n// after\nrd, err := c.details.Marshal()\nc.rawDetails = rd\nb, err := c.Marshal()","handlingStrategy":"validation","validationCode":"if c.rawDetails == nil {\n    return fmt.Errorf(\"certificate not initialized: rawDetails missing\")\n}","typeGuard":"func marshalable(c *cert.CertificateV2) bool {\n    _, err := c.Marshal()\n    return err == nil\n}","tryCatchPattern":"b, err := c.MarshalForHandshakes()\nif errors.Is(err, cert.ErrEmptyRawDetails) {\n    // certificate was never populated; rebuild from source\n}","preventionTips":["Never construct certificateV2 as a zero-value literal for real use","Populate rawDetails via the details marshal path before any serialization","Validate deserialized certificates immediately after parsing"],"tags":["certificate","marshal","uninitialized"],"backgroundTag":"missing-certificate-details","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}