paperclipai/paperclip · error · Error
Unsupported Discord correction field
Error message
Unsupported Discord correction field
What it means
While collecting modal values into a correction draft, each modal child must be a supported input type (text_input or select). This error is thrown when a modal child has an unrecognized or unsupported component type, so the correction draft cannot be built faithfully from the submitted values.
Source
Thrown at server/src/services/chat-discord-question-forms.ts:170
now.getTime() + CORRECTION_TTL_MS,
),
);
if (
!Number.isFinite(expiresAt.getTime()) ||
expiresAt <= now ||
input.modal.callbackId !== input.submitActionId ||
input.modal.privateMetadata !== input.submitActionId ||
input.modal.children.length < 1 ||
input.modal.children.length > 5
)
throw new Error("Discord form correction is not current");
const values: Record<string, string> = {};
const messages: string[] = [
"Please check your answers, then select Edit answers.",
];
for (const child of input.modal.children) {
if (child.type !== "text_input" && child.type !== "select")
throw new Error("Unsupported Discord correction field");
const value = input.values[child.id];
const error = input.fieldErrors[child.id];
// Both label and error are produced by canonical form validation, never
// provider labels/error bodies. Opaque input IDs are not visible copy.
if (error) messages.push(`${child.label}: ${error}`);
if (typeof value !== "string") continue;
if (child.type === "text_input") {
const maximum = Math.min(child.maxLength ?? 4000, 4000);
values[child.id] = value.slice(0, maximum);
if (value.length > maximum)
messages.push(
`${child.label}: This draft was shortened to ${maximum} characters.`,
);
} else if (child.options.some((option) => option.value === value))
values[child.id] = value;
}
const {
modal: _modal,View on GitHub (pinned to 01ad858492)
Solutions
- Inspect the modal children and remove or replace any unsupported component type before submission
- Extend the handler to explicitly support the new child type and map its value
- Check for library/package updates that changed Discord component type names
Example fix
// before
if (child.type !== "text_input" && child.type !== "select")
throw new Error("Unsupported Discord correction field");
// after
if (child.type === "text_input" || child.type === "select" || child.type === "new_component") {
// handle child
} else {
throw new Error("Unsupported Discord correction field");
} Defensive patterns
Strategy: type-guard
Validate before calling
function allChildrenSupported(children) {
return children.every((c) => c.type === "text_input" || c.type === "select");
}
if (!allChildrenSupported(modal.children)) throw new Error("build modal with supported field types only"); Type guard
const isSupportedChild = (c) => c && (c.type === "text_input" || c.type === "select");
Try / catch
try {
await retainDiscordQuestionFormCorrection(...);
} catch (err) {
if (err.message === "Unsupported Discord correction field") {
// rebuild modal with supported types
return respondWithRebuiltForm();
}
throw err;
} Prevention
- Only construct modals from the whitelisted component types in the form builder
- Add a unit test that every modal the builder emits passes the child-type check
- When Discord adds component types, update both builder and retention paths together
When it happens
Trigger: A modal contains a component whose type is neither 'text_input' nor 'select' (e.g. a newer Discord component kind, or a malformed custom-built child); the modal schema was extended elsewhere without updating this retention path.
Common situations: A developer adds a new modal component type (e.g. a new Discord input variant) to the form builder but forgets to support it in retainDiscordQuestionFormCorrection; a Discord API update introduces new component types.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Invalid Discord command owner identifier
- Invalid Discord command registration scope
- invalid_response
- Invalid Discord command registration authority
- Invalid Discord form token
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/4bef957a035cc217.
Report an issue: GitHub.