{"record":{"id":"777ddc9415b1a2c9","repo":"vuejs/vue-cli","slug":"invalid-type-for-option-vueplugins-service-expe","errorCode":null,"errorMessage":"Invalid type for option 'vuePlugins.service', expected 'array' but got ${typeof files}.","messagePattern":"Invalid type for option 'vuePlugins\\.service', expected 'array' but got (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli-service/lib/Service.js","lineNumber":222,"sourceCode":"            if (!apply) {\n              warn(`Optional dependency ${id} is not installed.`)\n              apply = () => {}\n            }\n\n            return { id, apply }\n          } else {\n            return idToPlugin(id, resolveModule(id, this.pkgContext))\n          }\n        })\n\n      plugins = builtInPlugins.concat(projectPlugins)\n    }\n\n    // Local plugins\n    if (this.pkg.vuePlugins && this.pkg.vuePlugins.service) {\n      const files = this.pkg.vuePlugins.service\n      if (!Array.isArray(files)) {\n        throw new Error(`Invalid type for option 'vuePlugins.service', expected 'array' but got ${typeof files}.`)\n      }\n      plugins = plugins.concat(files.map(file => ({\n        id: `local:${file}`,\n        apply: loadModule(`./${file}`, this.pkgContext)\n      })))\n    }\n    debug('vue:plugins')(plugins)\n\n    const orderedPlugins = sortPlugins(plugins)\n    debug('vue:plugins-ordered')(orderedPlugins)\n\n    return orderedPlugins\n  }\n\n  async run (name, args = {}, rawArgv = []) {\n    // resolve mode\n    // prioritize inline --mode\n    // fallback to resolved default modes from plugins or development if --watch is defined","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli-service/lib/Service.js#L204-L240","documentation":"Service.loadUserOptions reads local plugins from the `vuePlugins.service` field in package.json and maps each entry to a module file. It must be an array of path strings; any other type cannot be iterated with `.map`, so it is rejected with the actual typeof received.","triggerScenarios":"Setting `\"vuePlugins\": { \"service\": \"foo.js\" }` (a string) or an object/number in package.json's `vue` field instead of an array.","commonSituations":"Misunderstanding the field shape; copy-paste from docs that showed a single value; hand-editing package.json.","solutions":["Wrap the value in an array: `\"service\": [\"./vue-cli-plugin-custom.js\"]`.","Each array entry must be a path string resolvable from the project root."],"exampleFix":"// package.json \"vue\" field — before\n\"vue\": { \"vuePlugins\": { \"service\": \"./my-plugin.js\" } }\n// after\n\"vue\": { \"vuePlugins\": { \"service\": [\"./my-plugin.js\"] } }","handlingStrategy":"type-guard","validationCode":"const service = (require('./package.json').vue || {}).vuePlugins && require('./package.json').vue.vuePlugins.service\nif (service != null && !Array.isArray(service)) {\n  throw new Error(`vuePlugins.service must be an array, got ${typeof service}`)\n}","typeGuard":"const isServicePlugins = (v) => v == null || Array.isArray(v)","tryCatchPattern":null,"preventionTips":["Always wrap vuePlugins.service entries in an array in package.json.","Prefer vue.config.js for richer plugin config over the package.json vue field."],"tags":["configuration","package-json","type-validation"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}