phacility/phabricator · error · PhutilArgumentUsageException

Config key " " is locked and can only be set in local…

Error message

Config key "%s" is locked and can only be set in local configuration. To learn more, see "%s" in the documentation.

What it means

Policy guard in bin/config set execute(): the option is marked locked (bootstrap-critical) and --database was used. Locked keys may only be written to local configuration, never to the database, and the message links to the documentation on locked and hidden configuration.

Solutions

  1. Drop the --database flag and set the key in local configuration
  2. Read the Configuration Guide: Locked and Hidden Configuration for why the key is protected
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php:115 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/4cbcf23718dd9f00. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php:115

          $value = json_decode($value, true);
          if (!is_array($value)) {
            switch ($type) {
              default:
                $message = pht(
                  'Configuration key "%s" is of type "%s". Specify it in JSON.',
                  $key,
                  $type);
                break;
            }
            throw new PhutilArgumentUsageException($message);
          }
          break;
      }
    }

    $use_database = $args->getArg('database');
    if ($option->getLocked() && $use_database) {
      throw new PhutilArgumentUsageException(
        pht(
          'Config key "%s" is locked and can only be set in local '.
          'configuration. To learn more, see "%s" in the documentation.',
          $key,
          pht('Configuration Guide: Locked and Hidden Configuration')));
    }

    try {
      $option->getGroup()->validateOption($option, $value);
    } catch (PhabricatorConfigValidationException $validation) {
      // Convert this into a usage exception so we don't dump a stack trace.
      throw new PhutilArgumentUsageException($validation->getMessage());
    }

    if ($use_database) {
      $config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
      $config_entry->setValue($value);

View on GitHub (pinned to 5720a38cfe)