{"record":{"id":"9b2cc06f40a748a8","repo":"chenhg5/cc-connect","slug":"googlechat-create-response-missing-message-name","errorCode":null,"errorMessage":"googlechat: create response missing message name","messagePattern":"googlechat: create response missing message name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/googlechat/streaming.go","lineNumber":60,"sourceCode":"\tresp, err := p.doRequest(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"googlechat: send preview: %w\", err)\n\t}\n\tdefer func() {\n\t\tif err := resp.Body.Close(); err != nil {\n\t\t\tslog.Warn(\"googlechat: close preview response body\", \"error\", err)\n\t\t}\n\t}()\n\tvar msg struct {\n\t\tName string `json:\"name\"`\n\t}\n\tif err := json.NewDecoder(resp.Body).Decode(&msg); err != nil {\n\t\treturn nil, fmt.Errorf(\"googlechat: parse create response: %w\", err)\n\t}\n\t// drain any bytes json.Decoder left unread so the connection is reusable\n\t_, _ = io.Copy(io.Discard, resp.Body)\n\tif msg.Name == \"\" {\n\t\treturn nil, fmt.Errorf(\"googlechat: create response missing message name\")\n\t}\n\treturn &previewHandle{name: msg.Name}, nil\n}\n\n// buildUpdateRequest builds the PATCH URL and JSON body to update a message's text.\nfunc buildUpdateRequest(msgName, content string) (string, []byte, error) {\n\tu := chatAPIBase + msgName + \"?updateMask=text\"\n\tb, err := json.Marshal(map[string]any{\"text\": content})\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"googlechat: marshal update body: %w\", err)\n\t}\n\treturn u, b, nil\n}\n\n// UpdateMessage patches the preview message text in place. The engine passes the\n// handle returned by SendPreviewStart (not the reply context). Implements\n// core.MessageUpdater.\nfunc (p *Platform) UpdateMessage(ctx context.Context, handle any, content string) error {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/googlechat/streaming.go#L42-L78","documentation":"This error is thrown when the Google Chat API response to the create-message call decodes as JSON but the `name` field is empty. The message resource name (e.g. \"spaces/AAA/messages/MMM\") is required to build the PATCH URL used by UpdateMessage, so without it the library cannot hand back a usable preview handle. It is a defensive check that the API returned a well-formed message resource.","triggerScenarios":"SendPreviewStart decodes the response successfully but msg.Name == \"\" — the JSON body was valid yet lacked a \"name\" field (or it was empty), e.g. an unexpected success payload or an error-shaped JSON body sent with a misleading status code.","commonSituations":"Google Chat API version/behavior changes altering the response shape; a proxy returning a valid-JSON but non-message body; misconfigured auth causing an API error JSON (e.g. {\"error\":{...}}) to come back; custom chatAPIBase pointing at an endpoint that does not return message resources.","solutions":["Verify the response actually comes from the Google Chat API (correct chatAPIBase, no proxy substitution)","Check the API error payload in the body — an auth or permission failure often returns JSON without a message resource","Confirm the platform adapter version matches the current Google Chat API response schema (name field is required)","Enable request/response logging for the chat API call and inspect the payload"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"handle, err := p.SendPreviewStart(ctx, rctx, initialText)\nif err != nil {\n    if strings.Contains(err.Error(), \"missing message name\") {\n        slog.Warn(\"googlechat preview: API returned no message name; verify API schema and auth\", \"error\", err)\n    }\n    return fmt.Errorf(\"start streaming preview: %w\", err)\n}","preventionTips":["Pin to a supported Google Chat API surface; watch for response-schema changes in release notes","Validate auth/permissions so the API returns a real message resource, not an error JSON","Do not override chatAPIBase to unofficial endpoints"],"tags":["googlechat","api-response","missing-field","streaming-preview"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}