{"record":{"id":"8a7857dfff89937c","repo":"FiloSottile/age","slug":"expected-unsupported-stanza-got-q","errorCode":null,"errorMessage":"expected unsupported stanza, got %q","messagePattern":"expected unsupported stanza, got %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/plugin.go","lineNumber":664,"sourceCode":"\tcase \"fail\":\n\t\tif err := expectStanzaWithNoBody(s, 0); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%v\", err)\n\t\t}\n\t\treturn s, nil\n\tcase \"ok\":\n\t\treturn s, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"expected ok or fail stanza, got %q\", s.Type)\n\t}\n}\n\nfunc expectUnsupported(sr *format.StanzaReader) error {\n\tunsupported, err := sr.ReadStanza()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read unsupported stanza: %v\", err)\n\t}\n\tif unsupported.Type != \"unsupported\" {\n\t\treturn fmt.Errorf(\"expected unsupported stanza, got %q\", unsupported.Type)\n\t}\n\treturn expectStanzaWithNoBody(unsupported, 0)\n}\n\nfunc (p *Plugin) writeError(args []string, err error) error {\n\ts := &format.Stanza{Type: \"error\", Args: args}\n\ts.Body = []byte(err.Error())\n\tif err := s.Marshal(p.stdout); err != nil {\n\t\treturn fmt.Errorf(\"failed to write error stanza: %v\", err)\n\t}\n\tif err := expectOk(p.sr); err != nil {\n\t\treturn fmt.Errorf(\"%v\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":646,"sourceCodeEnd":680,"githubUrl":"https://github.com/FiloSottile/age/blob/b74dce4cdbe35b5e5f66c06d9612b72f89028758/plugin/plugin.go#L646-L680","documentation":"This error is thrown by the plugin's test/protocol helper expectUnsupported when, after sending an unsupported-recipient command, the plugin reads back a stanza whose Type is not \"unsupported\". It indicates the v1 plugin protocol handshake deviated from the expected sequence: the counterpart responded with a different stanza type than the required \"unsupported\" acknowledgment.","triggerScenarios":"Calling Plugin.RecipientV1 or Plugin.IdentityV1 in a mode that exercises the unsupported-stanza path while the StanzaReader returns a stanza with a Type other than \"unsupported\" (e.g. an \"ok\", \"error\", or body-carrying stanza).","commonSituations":"Custom or third-party age plugin clients that emit a wrong acknowledgement stanza; protocol-level regressions after changing the plugin message flow; a peer replying with an error stanza where an unsupported ack was expected.","solutions":["Inspect the %q value in the message to see which stanza type was actually received and trace who emitted it.","Verify the client/peer implements the age plugin protocol's unsupported-stanza acknowledgment correctly.","Confirm the order of stanzas written before calling expectUnsupported matches the protocol spec.","If you added custom stanzas, ensure unsupported recipients still produce a Type \"unsupported\" stanza."],"exampleFix":"// before\ns := &format.Stanza{Type: \"ack\"}\n// after\ns := &format.Stanza{Type: \"unsupported\"}","handlingStrategy":"validation","validationCode":"if st, ok := stanza.(*format.Stanza); !ok || st.Type != \"unsupported\" {\n    return fmt.Errorf(\"peer did not send unsupported stanza, got %v\", st)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Follow the age plugin protocol stanza ordering exactly when implementing clients.","Log every stanza type sent and received during plugin handshakes.","Test against the reference plugin implementation before deploying custom peers."],"tags":["go","protocol","plugin","stanza"],"backgroundTag":"plugin-protocol-stanza-mismatch","analyzedSha":"b74dce4cdbe35b5e5f66c06d9612b72f89028758","analyzedAt":"2026-08-31T23:59:31.627Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}