nodejs/node · error · Error

"${prop}" is not a property we can set. Valid properties are

Error message

"${prop}" is not a property we can set. Valid properties are: ${writableProfileKeys.join(', ')}

What it means

Thrown by the `profile set` method when the property name is not in the list of writable profile keys (writableProfileKeys). The npm profile API only allows setting certain properties — typically: name, email, password, fullname, homepage, freemail, twitter, github, and cidr_whitelist. Any other property name triggers this error.

Source

Thrown at deps/npm/lib/commands/profile.js:190

        log.warn('profile', 'Passwords do not match, please try again.')
        return readPasswords()
      }

      return newpassword
    }

    if (prop !== 'password' && value === null) {
      throw new Error('npm profile set <prop> <value>')
    }

    if (prop === 'password' && value !== null) {
      throw new Error(
        'npm profile set password\n' +
        'Do not include your current or new passwords on the command line.')
    }

    if (writableProfileKeys.indexOf(prop) === -1) {
      throw new Error(`"${prop}" is not a property we can set. ` +
        `Valid properties are: ` + writableProfileKeys.join(', '))
    }

    if (prop === 'password') {
      const current = await readUserInfo.password('Current password: ')
      const newpassword = await readPasswords()

      value = { old: current, new: newpassword }
    }

    // FIXME: Work around to not clear everything other than what we're setting
    const user = await get(conf)
    const newUser = {}

    for (const key of writableProfileKeys) {
      newUser[key] = user[key]
    }

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Use a valid writable property — the error message lists them via writableProfileKeys.join(', ')
  2. Check spelling against the list in the error message
  3. Run `npm profile get` to see current profile fields and identify which are settable

Example fix

// before
npm profile set twiter @myhandle

// after
npm profile set twitter myhandle
Defensive patterns

Strategy: validation

Validate before calling

const WRITABLE_PROFILE_KEYS = ['name', 'email', 'password', 'fullname', 'homepage', 'freemail', 'twitter', 'github', 'cidr_whitelist']
function isWritableProfileKey(prop) {
  return WRITABLE_PROFILE_KEYS.includes(prop)
}
// Before setting:
if (!isWritableProfileKey(prop)) {
  throw new Error(prop + ' is not writable. Valid: ' + WRITABLE_PROFILE_KEYS.join(', '))
}

Type guard

function isWritableProfileProp(prop) {
  return typeof prop === 'string'
    && ['name', 'email', 'password', 'fullname', 'homepage',
        'freemail', 'twitter', 'github', 'cidr_whitelist'].includes(prop)
}

Try / catch

try {
  await exec(['set', prop, value])
} catch (e) {
  if (e.message.includes('not a property we can set')) {
    console.error('Check writable properties in the error message')
  }
  throw e
}

Prevention

When it happens

Trigger: Running `npm profile set <invalid-prop> <value>` where invalid-prop is not in writableProfileKeys. The code checks `if (writableProfileKeys.indexOf(prop) === -1)`.

Common situations: Trying to set a property that doesn't exist on the npm profile model (e.g., `npm profile set username`, `npm profile set plan`). Misspelling a valid property (e.g., 'twiter' instead of 'twitter').

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/a3c3d235dcc6837b. Report an issue: GitHub.