Skip to content

MSC4369: M_CAPABILITY_NOT_ENABLED error code for when capability is not enabled on an API endpoint - #4369

Open
hughns wants to merge 8 commits into
mainfrom
hughns/capability-error-code
Open

hughns wants to merge 8 commits into
mainfrom
hughns/capability-error-code

Conversation

@hughns

@hughns hughns commented Oct 17, 2025 •

Copy link
Copy Markdown
Member

Rendered


I am employed by Element to write this MSC. Hence the use of the io.element namespace in the unstable values.

@hughns hughns changed the title M_CAPABILITY_NOT_ENABLED error code for when capability is not enabled on an API endpoint MSC4369: M_CAPABILITY_NOT_ENABLED error code for when capability is not enabled on an API endpoint Oct 17, 2025
@turt2live turt2live added proposal A matrix spec change proposal. Process state. A-Client Server Client-Server API kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. hacktoberfest-accepted labels Oct 17, 2025
@hughns
hughns requested a review from anoadragon453 October 22, 2025 14:47
@hughns
hughns marked this pull request as ready for review October 22, 2025 14:49

## Proposal

Define a new [other error code] of `M_CAPABILITY_NOT_ENABLED`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any value in having a specific error code for this? Clients should already know which endpoint is behind a capability, so M_FORBIDDEN should work just as well.

Actually I am wondering if instead of returning 403, it wouldn't be simpler to return 404 with M_UNRECOGNIZED, as if the endpoint is unimplemented?

This means that the endpoint doesn't actually have to be implemented by the homeserver if it doesn't support this capability (like POST /_matrix/client/v3/account/password which is useless if the homeserver only supports the OAuth 2.0 API for authentication), rather than forcing the homeserver to support this endpoint, only to return a specific error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I tried to think of it as a clearer way to signal why the call doesn't succeed; but actually, the proposed change to M_CAPABILITY_NOT_ENABLED when m.profile_fields.disallowed has a given profile field is confusing: if something is disallowed then M_FORBIDDEN is a natural return code for it, is it not?

I believe the spec could still do with a recommendation in "Capabilities negotiation" to use 404 M_UNRECOGNIZED or 403 M_FORBIDDEN (and bikeshed elaborate when to use which).

@anoadragon453
anoadragon453 removed their request for review September 24, 2026 10:39
@anoadragon453

Copy link
Copy Markdown
Member

@hughns apologies for having this sit on my queue for so long.

Is this still something you'd like to pursue?

@hughns

hughns commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

Is this still something you'd like to pursue?

I am motivated to resolve this lack of clarity - around what the server should return if the capability is not available but is attempted anyway - in the spec one way or another.

I'm not opposed to @zecakeh's comment about re-using existing codes if that feels like a better fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Client Server Client-Server API hacktoberfest-accepted kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal. Process state.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants