{"record":{"id":"34284ba9646a3588","repo":"vuejs/vue-cli","slug":"invalid-local-preset-path-path","errorCode":null,"errorMessage":"Invalid local preset path: ${path}","messagePattern":"Invalid local preset path: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli/lib/util/loadLocalPreset.js","lineNumber":11,"sourceCode":"const fs = require('fs-extra')\nconst loadPresetFromDir = require('./loadPresetFromDir')\n\nmodule.exports = async function loadLocalPreset (path) {\n  const stats = fs.statSync(path)\n  if (stats.isFile()) {\n    return await fs.readJson(path)\n  } else if (stats.isDirectory()) {\n    return await loadPresetFromDir(path)\n  } else {\n    throw new Error(`Invalid local preset path: ${path}`)\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":14,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli/lib/util/loadLocalPreset.js#L1-L14","documentation":"Thrown by loadLocalPreset when the given path is neither a regular file nor a directory — fs.statSync succeeds but the stats object reports neither isFile() nor isDirectory(). This is an edge case that typically indicates an unusual file system entry such as a symbolic link to a special file, a device node, or a broken/inaccessible path.","triggerScenarios":"Calling `vue create --preset <path>` where the path resolves to something that is not a standard file or directory (e.g., a FIFO, socket, device file, or a symlink to one).","commonSituations":"User passes a path to a special file by accident. A symlink points to a removed target, or to a non-file/directory inode. Very rare in normal development; more likely in scripted or automated environments where paths are dynamically generated.","solutions":["Verify the preset path points to a real file (a .json preset) or a directory containing preset.json: `ls -la <path>`.","If using a symlink, ensure it resolves to a valid file or directory: `readlink -f <path>`.","Use an absolute path to avoid ambiguity with relative resolution."],"exampleFix":"# before\n$ vue create my-app --preset /tmp/broken-symlink\nError: Invalid local preset path\n# after\n$ ls -la /path/to/preset.json\n$ vue create my-app --preset /path/to/preset.json","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst stats = fs.statSync(presetPath);\nif (!stats.isFile() && !stats.isDirectory()) {\n  console.error(`Invalid preset path: ${presetPath} is not a file or directory.`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const preset = await loadLocalPreset(presetPath);\n} catch (e) {\n  if (e.message.includes('Invalid local preset path')) {\n    console.error(`Preset path ${presetPath} is not a valid file or directory.`);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Verify the preset path points to a real file or directory before using it.","Resolve symlinks with fs.realpathSync to ensure they point to valid targets.","Use absolute paths for preset files to avoid relative resolution ambiguity."],"tags":["preset","filesystem","validation","create","path"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}