{"record":{"id":"98cab77ab8f8967a","repo":"halo-dev/halo","slug":"pluginmodule-ucroutes-must-be-an-array","errorCode":null,"errorMessage":"PluginModule.ucRoutes must be an array.","messagePattern":"PluginModule\\.ucRoutes must be an array\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ui/src/setup/setupModules.ts","lineNumber":674,"sourceCode":"}\n\nfunction preparePluginModule(\n  module: PluginModule,\n  registration: UiProviderRegistration,\n  report: (\n    registration: UiProviderRegistration,\n    stage: UiPluginFailureStage,\n    error: unknown\n  ) => void\n) {\n  if (module.components && !isRecord(module.components)) {\n    throw new TypeError(\"PluginModule.components must be an object.\");\n  }\n  if (module.routes && !Array.isArray(module.routes)) {\n    throw new TypeError(\"PluginModule.routes must be an array.\");\n  }\n  if (module.ucRoutes && !Array.isArray(module.ucRoutes)) {\n    throw new TypeError(\"PluginModule.ucRoutes must be an array.\");\n  }\n  if (module.formkit && !isRecord(module.formkit)) {\n    throw new TypeError(\"PluginModule.formkit must be an object.\");\n  }\n  if (module.extensionPoints && !isRecord(module.extensionPoints)) {\n    throw new TypeError(\"PluginModule.extensionPoints must be an object.\");\n  }\n  resetRouteMetaAndWrapChunks(module.routes, false, registration, report);\n  resetRouteMetaAndWrapChunks(module.ucRoutes, false, registration, report);\n}\n\nfunction resetRouteMetaAndWrapChunks(\n  routes: RouteRecordRaw[] | RouteRecordAppend[] | undefined,\n  core: boolean,\n  registration?: UiProviderRegistration,\n  report?: (\n    registration: UiProviderRegistration,\n    stage: UiPluginFailureStage,","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/ui/src/setup/setupModules.ts#L656-L692","documentation":"Thrown by preparePluginModule when module.ucRoutes is present but not an array. ucRoutes (user-center routes) must be RouteRecordRaw[] | RouteRecordAppend[], same shape as routes but registered in the user-facing area. A non-array value is rejected with a TypeError before the user-center router is touched.","triggerScenarios":"A plugin module returns { ucRoutes: { path: '/profile' } } (object) or a non-array during activation in the user-center app.","commonSituations":"Author copies the routes shape but forgets the array wrapper for ucRoutes; returns a single user-center route object; mis-merges config.","solutions":["Return ucRoutes as an array: { ucRoutes: [{ path: '/profile', component: Profile }] }.","Drop ucRoutes if the plugin adds no user-center routes.","Typecheck against PluginModule to catch the shape error at build time."],"exampleFix":"// before\nexport default definePluginModule({ ucRoutes: { name: \"profile\", path: \"/profile\", component: Profile } });\n\n// after\nexport default definePluginModule({ ucRoutes: [{ name: \"profile\", path: \"/profile\", component: Profile }] });","handlingStrategy":"type-guard","validationCode":"function assertUcRoutesShape(module: { ucRoutes?: unknown }) {\n  if (module.ucRoutes && !Array.isArray(module.ucRoutes)) {\n    throw new TypeError(\"PluginModule.ucRoutes must be an array.\");\n  }\n}","typeGuard":"function isRouteArray(value: unknown): value is unknown[] {\n  return Array.isArray(value);\n}","tryCatchPattern":null,"preventionTips":["Wrap user-center routes in an array literal.","Typecheck against PluginModule (ucRoutes is typed as the route array union).","Mirror the routes-array convention for ucRoutes."],"tags":["runtime","plugin-module","uc-routes","user-center","validation"],"backgroundTag":null,"analyzedSha":"d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8","analyzedAt":"2026-08-14T00:18:38.915Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}