{"record":{"id":"b77105e735b85792","repo":"paperclipai/paperclip","slug":"expected-build-validate-verify-install-publish-or-verify","errorCode":null,"errorMessage":"Expected build, validate, verify-install, publish, or verify.","messagePattern":"Expected build, validate, verify-install, publish, or verify\\.","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/cloud-migrator-artifacts.mjs","lineNumber":208,"sourceCode":"    aws([\"put-object\", \"--key\", objectKey, \"--body\", path.resolve(directory, file), \"--content-type\", contentType,\n      \"--cache-control\", \"public,max-age=31536000,immutable\", \"--if-none-match\", \"*\"]);\n  };\n  for (const name of names) upload(`${name}.tgz`, prefix + manifest.packages[name].url.slice(`${artifactBase}/`.length), \"application/gzip\");\n  upload(\"package-lock.json\", prefix + manifest.lockfile.url.slice(`${artifactBase}/`.length), \"application/json\");\n  // Publish the commit marker last; readers can never observe a partial bundle.\n  upload(\"manifest.json\", key, \"application/json\");\n  return verifyVisible();\n}\n\nif (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {\n  const [command, directory, sha] = process.argv.slice(2);\n  try {\n    if (command === \"build\") buildBundle(directory, sha);\n    else if (command === \"validate\") validateBundle(directory, sha);\n    else if (command === \"verify-install\") verifyInstall(directory, sha);\n    else if (command === \"publish\") await publishBundle(directory, sha);\n    else if (command === \"verify\") await verifyPublished(directory);\n    else throw new Error(\"Expected build, validate, verify-install, publish, or verify.\");\n  } catch (error) { console.error(error.message); process.exitCode = 1; }\n}\n","sourceCodeStart":190,"sourceCodeEnd":211,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/scripts/cloud-migrator-artifacts.mjs#L190-L211","documentation":"The cloud-migrator-artifacts.mjs CLI entrypoint dispatches exactly five subcommands (build, validate, verify-install, publish, verify); any other first argument hits the else branch and throws this message. It is a CLI usage guard, not a data validation failure.","triggerScenarios":"Running `node scripts/cloud-migrator-artifacts.mjs <unknown-cmd> ...` with a misspelled, empty, renamed, or omitted subcommand as process.argv[2].","commonSituations":"Typos like `--build` or `Build`; forgetting the command entirely (`node scripts/cloud-migrator-artifacts.mjs ./dir <sha>`); CI wrappers passing an option where the command belongs; assuming a `check` or `upload` alias exists.","solutions":["Run with one of the supported subcommands: build, validate, verify-install, publish, or verify.","Check argument order: `node scripts/cloud-migrator-artifacts.mjs <command> <directory> <sha>` (verify takes only the sha).","Inspect the dispatch block at scripts/cloud-migrator-artifacts.mjs:203-208 for the current command set if the script was updated."],"exampleFix":"// before\nnode scripts/cloud-migrator-artifacts.mjs upload ./artifacts <sha>\n// after\nnode scripts/cloud-migrator-artifacts.mjs publish ./artifacts <sha>","handlingStrategy":"validation","validationCode":"const COMMANDS = [\"build\",\"validate\",\"verify-install\",\"publish\",\"verify\"];\nif (!COMMANDS.includes(process.argv[2])) {\n  console.error(`Usage: node scripts/cloud-migrator-artifacts.mjs <${COMMANDS.join(\"|\")}> <dir> <sha>`);\n  process.exit(2);\n}","typeGuard":"const isCommand = (v) => [\"build\",\"validate\",\"verify-install\",\"publish\",\"verify\"].includes(v);","tryCatchPattern":"try {\n  await runCommand(cmd, dir, sha);\n} catch (error) {\n  if (/^Expected build, validate/.test(error.message)) printUsageAndExit(2);\n  throw error;\n}","preventionTips":["Wrap the script in a higher-level entry that validates argv before dispatch","Keep a usage/help subcommand so mistakes print usage instead of an error","Check CI step definitions when renaming commands"],"tags":["cli","invalid-cli-argument"],"backgroundTag":"invalid-cli-argument","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}