{"record":{"id":"69bc05044a1729cf","repo":"FiloSottile/age","slug":"s-stanza-has-0-bytes-of-body-want-0","errorCode":null,"errorMessage":"%s stanza has 0 bytes of body, want >0","messagePattern":"(.+?) stanza has 0 bytes of body, want >0","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/plugin.go","lineNumber":603,"sourceCode":"\treturn 1\n}\n\nfunc expectStanzaWithNoBody(s *format.Stanza, wantArgs int) error {\n\tif len(s.Args) != wantArgs {\n\t\treturn fmt.Errorf(\"%s stanza has %d arguments, want %d\", s.Type, len(s.Args), wantArgs)\n\t}\n\tif len(s.Body) != 0 {\n\t\treturn fmt.Errorf(\"%s stanza has %d bytes of body, want 0\", s.Type, len(s.Body))\n\t}\n\treturn nil\n}\n\nfunc expectStanzaWithBody(s *format.Stanza, wantArgs int) error {\n\tif err := expectStanzaWithAnyBody(s, wantArgs); err != nil {\n\t\treturn err\n\t}\n\tif len(s.Body) == 0 {\n\t\treturn fmt.Errorf(\"%s stanza has 0 bytes of body, want >0\", s.Type)\n\t}\n\treturn nil\n}\n\nfunc expectStanzaWithAnyBody(s *format.Stanza, wantArgs int) error {\n\tif len(s.Args) != wantArgs {\n\t\treturn fmt.Errorf(\"%s stanza has %d arguments, want %d\", s.Type, len(s.Args), wantArgs)\n\t}\n\treturn nil\n}\n\nfunc (p *Plugin) recipientError(idx int, err error) int {\n\tif err := p.writeError([]string{\"recipient\", fmt.Sprint(idx)}, err); err != nil {\n\t\treturn p.fatalf(\"%v\", err)\n\t}\n\treturn 3\n}\n","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/FiloSottile/age/blob/b74dce4cdbe35b5e5f66c06d9612b72f89028758/plugin/plugin.go#L585-L621","documentation":"expectStanzaWithBody enforces that a stanza which must carry payload data (e.g. the 'msg' body of a DisplayMessage or the prompt data of a Confirm/RequestValue reply path) actually has a non-empty body. A zero-length body means the plugin sent the stanza line but omitted the required data. The client cannot proceed without that payload.","triggerScenarios":"RecipientV1 read a stanza (via expectStanzaWithBody) whose argument count was correct but whose Body was empty — for instance a data-carrying reply stanza terminated immediately with a blank line.","commonSituations":"A plugin that hits an internal error and emits the stanza skeleton without the data; truncation of the plugin's stdout (short read, closed pipe); protocol mismatch where an older plugin omits a body this client requires.","solutions":["Check the plugin's stderr/logs for an internal failure that caused it to skip writing the body","Upgrade the plugin to a version matching this client's protocol expectations","Inspect the stanza type and args to confirm which payload was expected and why the plugin omitted it","If you wrote the plugin, ensure it writes body bytes followed by a blank line before terminating the stanza"],"exampleFix":"// before (plugin side)\nfmt.Printf(\"-> msg\\n\\n\") // empty body\n\n// after\nfmt.Printf(\"-> msg\\n%s\\n\\n\", messageText)","handlingStrategy":"validation","validationCode":"if len(stanza.Body) == 0 {\n    return fmt.Errorf(\"%s requires a non-empty body\", stanza.Type)\n}","typeGuard":"func hasBody(s *format.Stanza) bool {\n    return s != nil && len(s.Body) > 0\n}","tryCatchPattern":null,"preventionTips":["Verify the plugin writes body bytes before the terminating blank line","Check for pipe truncation when shelling out to plugins","Add integration tests that feed empty-body stanzas and assert the failure"],"tags":["age","plugin-protocol","stanza","missing-body"],"backgroundTag":"plugin-stanza-missing-body","analyzedSha":"b74dce4cdbe35b5e5f66c06d9612b72f89028758","analyzedAt":"2026-08-31T23:59:31.627Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}