paperclipai/paperclip · error · Error
Invalid Discord command owner identifier
Error message
Invalid Discord command owner identifier
What it means
discordPaperclipCommandDefinition validates the public owner marker with the ownerId Zod schema before building the Discord slash-command payload (type 1 CHAT_INPUT, name 'paperclip'). The marker is an identifier, not a credential; a value failing the schema (wrong shape/charset/length) throws this Error synchronously.
Source
Thrown at server/src/services/chat-discord-command-registration.ts:102
retryAfterSeconds?: number;
};
function freezeState(
state: DiscordCommandRegistration,
): DiscordCommandRegistration {
Object.freeze(state.scope);
if (state.phase === "attempted") {
Object.freeze(state.attempt.runtimeFence);
Object.freeze(state.attempt);
}
if (state.phase === "registered") Object.freeze(state.receipt);
return Object.freeze(state);
}
/** The public marker is an identifier, never a credential or standalone proof. */
export function discordPaperclipCommandDefinition(publicOwnerId: string) {
if (!ownerId.safeParse(publicOwnerId).success)
throw new Error("Invalid Discord command owner identifier");
return {
type: 1,
name: "paperclip",
description: `Paperclip session controls [pc:${publicOwnerId}]`,
options: [
{
type: 1,
name: "status",
description: "Show the current Paperclip task",
},
{
type: 1,
name: "new",
description: "Start a new task in a DM or show new-thread guidance",
},
{
type: 1,
name: "close",View on GitHub (pinned to 01ad858492)
Solutions
- Pass a schema-conformant owner id — ideally the ownerId generated by createDiscordCommandRegistration (randomBytes(16) hex).
- Log/inspect the value passed in and trim or strip invalid characters (e.g. drop the '#1234' discriminator).
- Validate with the same ownerId schema on the caller side before invoking the function.
- If migrating stored registrations, re-mint the owner id rather than reusing a legacy non-conforming identifier.
Example fix
// before
const def = discordPaperclipCommandDefinition("Ada Lovelace#0001"); // throws
// after
const reg = createDiscordCommandRegistration(scope);
const def = discordPaperclipCommandDefinition(reg.ownerId); // hex id Defensive patterns
Strategy: validation
Validate before calling
import { ownerId } from './chat-discord-command-registration';
if (!ownerId.safeParse(publicOwnerId).success) throw new Error('owner id does not match the Discord command ownerId schema'); Type guard
function isValidOwnerId(v) { return typeof v === 'string' && /^[0-9a-f]{32}$/.test(v); } // adjust to the actual schema Try / catch
let definition;
try {
definition = discordPaperclipCommandDefinition(publicOwnerId);
} catch (e) {
if (/Invalid Discord command owner identifier/.test(e.message)) {
const reg = createDiscordCommandRegistration(scope);
definition = discordPaperclipCommandDefinition(reg.ownerId);
} else throw e;
} Prevention
- Always mint the owner id via createDiscordCommandRegistration instead of hand-rolling it.
- Strip user-facing handles ('name#0001', spaces) before passing identifiers.
- Store the hex owner id, never a Discord username or tag.
- Validate ids with the shared Zod schema at the boundary.
When it happens
Trigger: Calling discordPaperclipCommandDefinition with an empty string, undefined/null, or a value containing characters outside the ownerId schema (e.g. spaces, symbols, or overly long ids) instead of the hex/random or schema-conformant owner identifier.
Common situations: Passing a Discord user tag like 'user#1234' or display name with spaces; passing a whole JSON blob instead of the id; forgetting to mint the owner via createDiscordCommandRegistration and passing a placeholder like 'me'.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Invalid Discord command registration scope
- Invalid Discord form token
- device-login promotion: the account identifier cannot form a
- Unsafe ${label}: ${result}
- Invalid normalized OpenCode session id
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/830e0da7d3ff7a2a.
Report an issue: GitHub.