jumpserver/jumpserver · error · JMSException

The value in the parameter must contain %s

Error message

The value in the parameter must contain %s

What it means

Raised by the third-party-backend unbinding endpoint (common.py) when the `backend` parameter passed to the request does not match any supported backend key in backend_map (e.g. 'slack'). The message interpolates the allowed keys, telling the caller which backend names are accepted.

Source

Thrown at apps/authentication/api/common.py:33

logger = get_logger(__file__)


class QRUnBindBase(APIView):
    user: User

    def post(self, request: Request, backend: str, **kwargs):
        backend_map = {
            'wecom': {'user_field': 'wecom_id', 'not_bind_err': errors.WeComNotBound},
            'dingtalk': {'user_field': 'dingtalk_id', 'not_bind_err': errors.DingTalkNotBound},
            'feishu': {'user_field': 'feishu_id', 'not_bind_err': errors.FeiShuNotBound},
            'lark': {'user_field': 'lark_id', 'not_bind_err': errors.LarkNotBound},
            'slack': {'user_field': 'slack_id', 'not_bind_err': errors.SlackNotBound},
        }
        user = self.user

        backend_info = backend_map.get(backend)
        if not backend_info:
            raise JMSException(
                _('The value in the parameter must contain %s') % ', '.join(backend_map.keys())
            )

        if not getattr(user, backend_info['user_field'], None):
            raise backend_info['not_bind_err']

        setattr(user, backend_info['user_field'], None)
        user.save()
        return Response()


class QRUnBindForUserApi(RoleUserMixin, QRUnBindBase):
    permission_classes = (IsValidUser, UserConfirmation.require(ConfirmType.RELOGIN),)


class QRUnBindForAdminApi(RoleAdminMixin, QRUnBindBase):
    permission_classes = (OnlySuperUser,)
    user_id_url_kwarg = 'user_id'

View on GitHub (pinned to 6ec464fabd)

Solutions

  1. Check the error message: it lists the exact valid backend values (e.g. 'slack'); resend the request with one of those
  2. Verify the parameter name and that it is transmitted in the place the serializer expects (body vs query string)
  3. Update the frontend/backend constant list to match apps/authentication/api/common.py backend_map keys

Example fix

# before
POST /api/v1/authentication/users/backends/unbind/
{"backend": "Slack"}
# after
POST /api/v1/authentication/users/backends/unbind/
{"backend": "slack"}
Defensive patterns

Strategy: validation

Validate before calling

valid_backends = ['slack']  # keep in sync with backend_map keys
if backend not in valid_backends:
    raise ValueError(f"backend must be one of {valid_backends}")
unbind(backend)

Prevention

When it happens

Trigger: POSTing to the unbind/social-account endpoint with backend missing, misspelled, or unsupported (e.g. backend=dingtalk when only keys like 'slack' exist), or omitting it so backend_map.get(backend) returns None.

Common situations: Frontend sends a stale or renamed backend name after an upgrade; developer copies an example that references a backend not enabled in this installation; trailing whitespace/case mismatch in the query or body parameter.

Related errors


AI-assisted analysis of jumpserver/jumpserver@6ec464fabd (2026-08-28). Data as JSON: /api/errors/823b48196b248564. Report an issue: GitHub.