{"record":{"id":"0d99de3ee9d7b599","repo":"goreleaser/goreleaser","slug":"could-not-serialize-request-w","errorCode":null,"errorMessage":"could not serialize request: %w","messagePattern":"could not serialize request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/mcp/mcp.go","lineNumber":164,"sourceCode":"\t\t\treturn fmt.Errorf(\"could not apply templates: %w\", err)\n\t\t}\n\t\tversion := ctx.Version\n\t\tif pkg.RegistryType == \"oci\" {\n\t\t\tversion = \"\"\n\t\t}\n\t\tserver.Packages = append(server.Packages, model.Package{\n\t\t\tRegistryType: pkg.RegistryType,\n\t\t\tIdentifier:   pkg.Identifier,\n\t\t\tVersion:      version,\n\t\t\tTransport: model.Transport{\n\t\t\t\tType: pkg.Transport.Type,\n\t\t\t},\n\t\t})\n\t}\n\n\tjsonData, err := json.Marshal(server)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not serialize request: %w\", err)\n\t}\n\n\tpublishURL := p.registry + \"/v0/publish\"\n\n\treturn retryx.Do(ctx, ctx.Config.Retry, func() error {\n\t\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, publishURL, bytes.NewReader(jsonData))\n\t\tif err != nil {\n\t\t\treturn retryx.Unrecoverable(fmt.Errorf(\"could not create request: %w\", err))\n\t\t}\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\treq.Header.Set(\"Authorization\", \"Bearer \"+token)\n\n\t\tresp, err := http.DefaultClient.Do(req)\n\t\tif err != nil {\n\t\t\treturn retryx.HTTP(fmt.Errorf(\"could not send request: %w\", err), resp)\n\t\t}\n\t\tdefer resp.Body.Close()\n","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/mcp/mcp.go#L146-L182","documentation":"Wrapped error in the MCP pipe's Publish: json.Marshal failed to serialize the assembled server model (packages, transports, repository) for the /v0/publish request. Like other marshal guards over config-derived structs, failure indicates structurally invalid content rather than a network problem.","triggerScenarios":"Thrown at internal/pipe/mcp/mcp.go:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Practically unreachable: the server model serializes to JSON unless it holds unsupported types","Check custom fields injected into the server model for non-marshalable values","Simplify transports/packages config if custom values were added"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}