quasarframework/quasar · error · TypeError

cancelScaffolding() expects an options object: { message?, e

Error message

cancelScaffolding() expects an options object: { message?, exit? }

What it means

cancelScaffolding() in create-quasar accepts only an options object ({ message?, exit? }). Because the implementation destructures the argument, a non-object value (e.g. a plain string message) would be silently dropped, so the function deliberately throws a TypeError instead. It exists so extension authors calling this internal API do so with the correct shape.

Source

Thrown at create-quasar/lib/utils.js:59

}

const TEMPLATING_FILE_EXTENSIONS = [
  '',
  '.json',
  '.js',
  '.cjs',
  '.ts',
  '.vue',
  '.md',
  '.html',
  '.sass'
]

function cancelScaffolding(opts = {}) {
  // only the object form is valid; anything else (e.g. a plain string
  // message) would get silently dropped by the destructuring below
  if (typeof opts !== 'object' || opts === null) {
    throw new TypeError(
      'cancelScaffolding() expects an options object: { message?, exit? }'
    )
  }

  const { message = 'Scaffolding cancelled', exit = true } = opts

  cancel(message)
  if (exit !== false) process.exit(exit === true ? 1 : exit)
}

function exitOnCancel(val) {
  if (isCancel(val)) cancelScaffolding()
  return val
}

async function promptUser(
  scope,
  questions,

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Change the call to pass an object: cancelScaffolding({ message: 'Cancelled by user' })
  2. If you only want to cancel without exiting, pass { exit: false } explicitly
  3. Pin/align your create-quasar version with the documented API and update custom wrappers that pass a string
  4. Wrap the call in try/catch if you cannot control legacy call sites, and log opts for diagnosis

Example fix

// before
cancelScaffolding('Scaffolding cancelled by user')
// after
cancelScaffolding({ message: 'Scaffolding cancelled by user', exit: true })
Defensive patterns

Strategy: validation

Validate before calling

function assertCancelOpts(opts) {
  if (typeof opts !== 'object' || opts === null) {
    throw new TypeError('cancelScaffolding() expects { message?, exit? }')
  }
}
assertCancelOpts(myOpts) // call before invoking cancelScaffolding

Type guard

function isCancelOptions(v) {
  return typeof v === 'object' && v !== null
}

Try / catch

try {
  cancelScaffolding({ message, exit: true })
} catch (err) {
  if (err instanceof TypeError && err.message.includes('options object')) {
    cancelScaffolding({ message: 'Scaffolding cancelled' })
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Calling cancelScaffolding('my message') or cancelScaffolding(null/undefined-as-non-object) instead of cancelScaffolding({ message: 'my message' }). Raise paths: createProjectFolder, exitOnCancel and promptUser call it when scaffolding is aborted (Ctrl+C / prompt cancel).

Common situations: Wrapping or monkey-patching create-quasar internals in custom scaffolding scripts; upgrading create-quasar where an older string-parameter call signature changed to an options object; custom automation that simulates a user cancel.

Understand the failure class

Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/d14ab4177ae3c62c. Report an issue: GitHub.