{"record":{"id":"318beef1ad7387dd","repo":"can1357/oh-my-pi","slug":"plugin-id-exceeds-max-id-length-characters","errorCode":null,"errorMessage":"Plugin ID exceeds ${MAX_ID_LENGTH} characters: \"${id}\"","messagePattern":"Plugin ID exceeds (.+?) characters: \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensibility/plugins/marketplace/types.ts","lineNumber":33,"sourceCode":"const MAX_NAME_LENGTH = 64;\nconst MAX_ID_LENGTH = 128;\n\n/** Validate a plugin or marketplace name segment. */\nexport function isValidNameSegment(s: string): boolean {\n\treturn s.length > 0 && s.length <= MAX_NAME_LENGTH && NAME_RE.test(s);\n}\n\n/** Build canonical plugin ID: `\"name@marketplace\"`. Both segments are validated. */\nexport function buildPluginId(name: string, marketplace: string): string {\n\tif (!isValidNameSegment(name)) {\n\t\tthrow new Error(`Invalid plugin name: \"${name}\"`);\n\t}\n\tif (!isValidNameSegment(marketplace)) {\n\t\tthrow new Error(`Invalid marketplace name: \"${marketplace}\"`);\n\t}\n\tconst id = `${name}@${marketplace}`;\n\tif (id.length > MAX_ID_LENGTH) {\n\t\tthrow new Error(`Plugin ID exceeds ${MAX_ID_LENGTH} characters: \"${id}\"`);\n\t}\n\treturn id;\n}\n\n/** Parse `\"name@marketplace\"` → `{ name, marketplace }` or `null`. */\nexport function parsePluginId(id: string): { name: string; marketplace: string } | null {\n\tconst atIndex = id.lastIndexOf(\"@\");\n\tif (atIndex <= 0 || atIndex === id.length - 1) return null;\n\n\tconst name = id.slice(0, atIndex);\n\tconst marketplace = id.slice(atIndex + 1);\n\n\tif (!isValidNameSegment(name) || !isValidNameSegment(marketplace)) return null;\n\n\treturn { name, marketplace };\n}\n\n// ── Marketplace catalog (from marketplace.json in a marketplace repo) ─","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/extensibility/plugins/marketplace/types.ts#L15-L51","documentation":"buildPluginId checks that the assembled `name@marketplace` ID fits within MAX_ID_LENGTH (128 characters) even though each segment alone is ≤64. This throw means both segments are individually valid but their combined length exceeds the canonical ID cap, so the ID cannot be stored/compared safely in the installed-plugins registry. It surfaces only when both segments are near their maximum length.","triggerScenarios":"Calling buildPluginId with a name and marketplace whose combined length plus the `@` exceeds 128 characters — e.g. a near-64-char plugin name plus a near-64-char marketplace slug summing past 128 with the `@` separator.","commonSituations":"Extremely long descriptive plugin names combined with long marketplace slugs (both auto-derived from URLs or package names); generated IDs from un-slugged paths; migrating legacy entries that predated the length cap.","solutions":["Shorten the plugin name and/or marketplace slug so the combined `name@marketplace` is ≤128 characters (practically: keep both well under 64).","If the marketplace slug is long, register it under a shorter alias and use the alias in plugin IDs.","Validate total length before building: `name.length + 1 + marketplace.length <= 128` and reject earlier with a clearer message.","If this comes from an old stored ID, migrate it via parsePluginId and re-issue with truncated slugs."],"exampleFix":"// before\nconst id = buildPluginId(\"a-very-long-descriptive-plugin-name-that-goes-on-and-on-forever-x\", \"an-equally-long-marketplace-slug-name-also-extremely-long\");\n// after\nconst id = buildPluginId(\"long-plugin-name\", \"acme\");","handlingStrategy":"validation","validationCode":"if (name.length + 1 + marketplace.length > 128) {\n\tthrow new Error(`Plugin ID \"${name}@${marketplace}\" exceeds 128 chars; shorten one of the segments.`);\n}","typeGuard":"function fitsIdLength(name: string, marketplace: string): boolean {\n\treturn name.length + 1 + marketplace.length <= 128;\n}","tryCatchPattern":"let id: string;\ntry {\n\tid = buildPluginId(name, marketplace);\n} catch (err) {\n\tif (err instanceof Error && err.message.includes('exceeds 128 characters')) {\n\t\tid = buildPluginId(name.slice(0, 32), marketplace.slice(0, 32));\n\t} else throw err;\n}","preventionTips":["Keep both name and marketplace segments well under 64 chars (e.g. ≤32) so the combined ID always fits.","Truncate long auto-derived slugs to a fixed budget before building IDs.","Add a config-load check that rejects catalog entries whose combined ID length exceeds 128.","Prefer short marketplace aliases over long descriptive slugs."],"tags":["validation","naming","length-limit","plugin-id"],"backgroundTag":"identifier-length-exceeded","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}