{"record":{"id":"ce351afc5e05c4d1","repo":"temporalio/temporal","slug":"failed-to-encode-link-w","errorCode":null,"errorMessage":"failed to encode link: %w","messagePattern":"failed to encode link: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/nexus/nexusrpc/api.go","lineNumber":144,"sourceCode":"\treturn httpHeader\n}\n\nfunc addContextTimeoutToHTTPHeader(ctx context.Context, httpHeader http.Header) http.Header {\n\tdeadline, ok := ctx.Deadline()\n\tif !ok {\n\t\treturn httpHeader\n\t}\n\thttpHeader.Set(nexus.HeaderRequestTimeout, FormatDuration(time.Until(deadline)))\n\treturn httpHeader\n}\n\nconst linkTypeKey = \"type\"\n\n// decodeLink encodes the link to Nexus-Link header value.\n// It follows the same format of HTTP Link header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link\nfunc encodeLink(link nexus.Link) (string, error) {\n\tif err := validateLinkURL(link.URL); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to encode link: %w\", err)\n\t}\n\tif err := validateLinkType(link.Type); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to encode link: %w\", err)\n\t}\n\treturn fmt.Sprintf(`<%s>; %s=\"%s\"`, link.URL.String(), linkTypeKey, link.Type), nil\n}\n\n// decodeLink decodes the Nexus-Link header values.\n// It must have the same format of HTTP Link header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link\nfunc decodeLink(encodedLink string) (nexus.Link, error) {\n\tvar link nexus.Link\n\tencodedLink = strings.TrimSpace(encodedLink)\n\tif len(encodedLink) == 0 {\n\t\treturn link, errors.New(\"failed to parse link header: value is empty\")\n\t}\n\n\tif encodedLink[0] != '<' {\n\t\treturn link, fmt.Errorf(\"failed to parse link header: invalid format: %s\", encodedLink)","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/nexus/nexusrpc/api.go#L126-L162","documentation":"Error \"failed to encode link: %w\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at common/nexus/nexusrpc/api.go:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}