RocketChat/Rocket.Chat · error · Error
error-invalid-actionlink
Error message
error-invalid-actionlink
What it means
actionLinks.run() throws error-invalid-actionlink when no entry in message.actionLinks has a method_id equal to the clicked actionMethodId (message.actionLinks?.find(...) returns undefined). Action links are attached to messages by the server (Apps Engine apps, external integrations) and each button carries a method_id that must be present in the message payload for the client to resolve it.
Solutions
- Log message.actionLinks for the clicked message and confirm the method_id you pass actually exists in the array.
- Re-fetch or refresh the message (e.g. via /v1/chat.getMessage) before running the link so the payload is current.
- If you develop an app, keep method_id values stable across message updates to avoid stale-button clicks.
Example fix
// before
actionLinks.run(message, methodId);
// after
if (message.actionLinks?.some((a) => a.method_id === methodId)) {
actionLinks.run(message, methodId);
} Defensive patterns
Strategy: validation
Validate before calling
const link = message.actionLinks?.find((a) => a.method_id === methodId); if (!link) return; // nothing to run actionLinks.run(message, methodId);
Type guard
const hasActionLink = (message: IMessage, methodId: string): boolean => Boolean(message.actionLinks?.some((a) => a.method_id === methodId));
Try / catch
try {
actionLinks.run(message, methodId);
} catch (e) {
if (e instanceof Error && e.message === 'error-invalid-actionlink') {
// stale message: refresh it before retrying
await refreshMessage(message._id);
return;
}
throw e;
} Prevention
- Re-fetch the message when its actionLinks-bearing UI is older than the latest server version.
- Keep method_id values stable across app releases.
- Only render action-link buttons for entries actually present in message.actionLinks.
When it happens
Trigger: Clicking an action-link button whose method_id argument does not match any entry in message.actionLinks — e.g. the rendered message is stale (actionLinks were changed server-side after render), the method_id was renamed, or custom code calls actionLinks.run with a hardcoded method_id.
Common situations: An Apps Engine app publishes a new message version removing/renaming action links while the old message is still on screen; a jump-to-message renders an old cached copy; a custom integration emits method_ids the client message payload no longer contains.
Related errors
- error-app-prevented-deleting
- Message converter not found
- A new user type has been added that the Apps don't know…
- A video conference must exist to update.
- app-addon-not-valid
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/ec0c5160305d9763.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/client/lib/actionLinks.ts:27
register(name: string, fn: (message: IMessage, params: string) => void): void {
actionLinks.actions.set(name, fn);
},
run(actionMethodId: string, message: IMessage): void {
const embedded = isLayoutEmbedded();
if (embedded) {
fireGlobalEvent('click-action-link', {
actionlink: actionMethodId,
value: message._id,
message,
});
return;
}
const actionLink = message.actionLinks?.find((action) => action.method_id === actionMethodId);
if (!actionLink) {
throw new Error('error-invalid-actionlink');
}
if (!actionLinks.actions.has(actionLink.method_id)) {
throw new Error('error-invalid-actionlink');
}
const fn = actionLinks.actions.get(actionLink.method_id);
fn?.(message, actionLink.params);
},
};
View on GitHub (pinned to b2c16d5842)