multica-ai/multica · error · ErrStateSignature

composio: state signature mismatch

Error message

composio: state signature mismatch

What it means

Sentinel error ErrStateSignature from Composio verifyState: the HMAC-SHA256 signature over the payload didn't match (hmac.Equal), meaning the state was tampered with or signed with a different secret. Like all state errors, surfaced to users as an indistinct 'connect failed' to avoid revealing which check failed.

Solutions

  1. Restart the OAuth flow from the original client so the state signature matches.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/internal/integrations/composio/state.go:22 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/7a0cb9873701babb. Report an issue: GitHub.

Appendix: source

Thrown at server/internal/integrations/composio/state.go:22

	"crypto/hmac"
	"crypto/sha256"
	"encoding/base64"
	"encoding/json"
	"errors"
	"strings"
	"time"
)

// Signed-state errors. The handler maps all of them to a generic
// "connect failed" redirect so a tampered/expired state never leaks which
// check failed.
var (
	// ErrStateMalformed is returned when the state token is not the expected
	// "<payload>.<sig>" base64url shape.
	ErrStateMalformed = errors.New("composio: state malformed")
	// ErrStateSignature is returned when the HMAC signature does not match —
	// the state was tampered with or signed by a different secret.
	ErrStateSignature = errors.New("composio: state signature mismatch")
	// ErrStateExpired is returned when the state's exp claim is in the past.
	ErrStateExpired = errors.New("composio: state expired")
)

// stateClaims is the payload embedded in the signed connect-state. It carries
// exactly what CompleteCallback needs to attribute the callback to a user and
// toolkit without a server-side session table — the signature is what makes it
// trustworthy, the short exp is what bounds replay.
//
// Field names are single letters to keep the encoded token compact; they are
// an internal wire format, never exposed to clients.
type stateClaims struct {
	UserID      string `json:"u"`
	ToolkitSlug string `json:"t"`
	// AuthConfigID is the exact Composio auth_config_id resolved at BeginConnect
	// and used to create the connect link. Signing it into the state lets
	// CompleteCallback verify the returned account was created under THIS
	// toolkit's auth config without re-resolving (which could fail-open). It is

View on GitHub (pinned to 2c0912b6ec)