appwrite/appwrite · error · Exception

Missing required variable: {$name}. Provide it using the --v

Error message

Missing required variable: {$name}. Provide it using the --variables flag to resolve this.

What it means

Error "Missing required variable: {$name}. Provide it using the --variables flag to resolve this." thrown in appwrite/appwrite.

Source

Thrown at src/Appwrite/Platform/Tasks/Screenshot.php:220

        $variables['APPWRITE_API_KEY'] = $apiKey;

        // Create variables
        if (!empty($template['variables'] ?? [])) {
            foreach ($template['variables'] as $variable) {
                $name = $variable['name'];

                $value = $variable['value'];
                $value = \str_replace('{projectName}', $projectName, $value);
                $value = \str_replace('{projectId}', $projectId, $value);
                $value = \str_replace('{apiEndpoint}', 'http://' . System::getEnv('_APP_DOMAIN', '') . '/v1', $value);

                if (\array_key_exists($name, $variables)) {
                    $value = $variables[$name];
                }

                if (empty($value)) {
                    if (($variable['required'] ?? false) === true) {
                        throw new \Exception("Missing required variable: {$variable['name']}. Provide it using the --variables flag to resolve this.");
                    }

                    continue;
                }

                $response = $client->call(Client::METHOD_POST, '/sites/' . $siteId . '/variables', [
                    'content-type' => 'application/json',
                    'x-appwrite-project' => $projectId,
                    'x-appwrite-mode' => 'admin',
                    'cookie' => $cookieConsole
                ], [
                    'key' => $variable['name'],
                    'value' => $value
                ]);

                if ($response['headers']['status-code'] !== 201) {
                    Console::error(\json_encode($response));
                    throw new \Exception("Failed to create variable");

View on GitHub (pinned to a1d520eea4)

Solutions

  1. Pass the missing variable via the --variables flag, e.g. --variables=NAME=value.
  2. Check the template definition for the list of required variables and supply each one.

When it happens

Trigger: Thrown at src/Appwrite/Platform/Tasks/Screenshot.php:220 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of appwrite/appwrite@a1d520eea4 (2026-08-18). Data as JSON: /api/errors/9c08deaafa35f515. Report an issue: GitHub.