multica-ai/multica · error · ErrCredentialValidation

dingtalk: could not validate credentials

Error message

dingtalk: could not validate credentials

What it means

Sentinel error ErrCredentialValidation from DingTalk RegisterBYO: a live access-token mint against the DingTalk API rejected the pasted AppKey/AppSecret pair (wrapped with the underlying cause). Treated as a user error — 400 guiding the admin to recheck credentials — not an outage.

Solutions

  1. Check the DingTalk AppKey and AppSecret, then retry credential validation.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/internal/integrations/dingtalk/byo_install.go:26 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/2f3cb22a72ce19cc. Report an issue: GitHub.

Appendix: source

Thrown at server/internal/integrations/dingtalk/byo_install.go:26

	"fmt"
	"strings"

	"github.com/jackc/pgx/v5/pgtype"

	db "github.com/multica-ai/multica/server/pkg/db/generated"
)

// ErrInvalidAppKey / ErrInvalidAppSecret are returned by RegisterBYO when a
// pasted credential is empty. The handler maps them to 400 so the dialog can
// show a precise hint instead of a generic failure.
var (
	ErrInvalidAppKey    = errors.New("dingtalk: AppKey (client id) is required")
	ErrInvalidAppSecret = errors.New("dingtalk: AppSecret (client secret) is required")
	// ErrCredentialValidation wraps a live access-token mint that rejected the
	// pasted AppKey/AppSecret. It is a user error (bad credentials), so the
	// handler maps it to 400 — unlike an internal encrypt/persist failure, which
	// must surface as 500.
	ErrCredentialValidation = errors.New("dingtalk: could not validate credentials")
)

// RegisterBYOParams are the inputs for a bring-your-own-app install: the agent
// this bot represents, who is installing, and the two credentials the user
// pasted from their own DingTalk Stream-mode robot.
type RegisterBYOParams struct {
	WorkspaceID pgtype.UUID
	AgentID     pgtype.UUID
	InitiatorID pgtype.UUID
	AppKey      string // client id — robotCode + access-token mint
	AppSecret   string // client secret — access-token mint (encrypted at rest)
}

// RegisterBYO installs a user-supplied ("bring your own") DingTalk robot for an
// default agent. The user creates their own DingTalk Stream-mode robot and pastes its
// AppKey (client id) + AppSecret (client secret). There is NO OAuth code
// exchange: we validate the credentials live by minting an access_token (which
// proves the AppKey/AppSecret pair is valid), encrypt the AppSecret at rest, and

View on GitHub (pinned to 2c0912b6ec)