t8y2/dbx · error

unknown method: %s

Error message

unknown method: %s

What it means

The JSON-RPC style dispatcher in the etcd agent's handle method received a method name that has no case in its switch. Only a fixed set of method strings is supported; anything else is rejected. This is a client-side protocol/typo problem, not an etcd failure.

Source

Thrown at agents/drivers/etcd-go/main.go:432

		return s.authRoleList(params)
	case "etcd_auth_role_get":
		return s.authRoleGet(params)
	case "etcd_auth_role_add":
		return s.authRoleAdd(params)
	case "etcd_auth_role_delete":
		return s.authRoleDelete(params)
	case "etcd_auth_role_grant_permission":
		return s.authRolePermission(params, true)
	case "etcd_auth_role_revoke_permission":
		return s.authRolePermission(params, false)
	case "disconnect":
		s.close()
		return map[string]bool{"ok": true}, nil
	case "shutdown":
		s.close()
		return map[string]bool{"ok": true}, nil
	default:
		return nil, fmt.Errorf("unknown method: %s", method)
	}
}

func decodeParams(params map[string]json.RawMessage, target any) error {
	if params == nil {
		params = map[string]json.RawMessage{}
	}
	data, err := json.Marshal(params)
	if err != nil {
		return err
	}
	return json.Unmarshal(data, target)
}

func stringParam(params map[string]json.RawMessage, key string) string {
	if params == nil {
		return ""
	}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Compare the method string against the agent's supported switch cases and fix the typo/casing
  2. Check which agent driver (etcd-go vs etcd2-go) you are talking to — method sets differ
  3. Upgrade client and agent together if the method was added in a newer version

Example fix

// before
agent.call("Watch", params) // wrong casing

// after
agent.call("watch", params) // exact match against the handle switch
Defensive patterns

Strategy: validation

Validate before calling

var supportedMethods = map[string]bool{"connect":true,"get":true,"put":true,"delete":true,"watch":true,"close":true,"shutdown":true /* ...match the handle switch */}
func validMethod(m string) bool { return supportedMethods[m] }

Try / catch

resp, err := agent.Call(method, params)
if err != nil && strings.Contains(err.Error(), "unknown method") {
    return fmt.Errorf("method %q not supported by this agent driver: %w", method, err)
}

Prevention

When it happens

Trigger: Sending a request whose method string does not exactly match one of the supported cases (e.g. 'put', 'get', 'watch', 'close', 'shutdown', ...) — case-sensitive match required.

Common situations: Typos or wrong casing in the method name ('Get' vs 'get'); calling a method from the etcd2 agent that only exists in the etcd3 agent (or vice versa); version drift between client and agent; generic wrappers dispatching dynamically-built names.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/da51d4cdac8d7366. Report an issue: GitHub.