coollabsio/coolify · error · Exception

Invalid timezone.

Error message

Invalid timezone.

What it means

Before persisting server settings, syncData() validates serverTimezone with validate_timezone(), which is a strict in_array($tz, timezone_identifiers_list()) lookup. PHP accepts only real tz identifiers (UTC, Europe/Budapest-style Region/City keys) - abbreviations like CET or EST, offset strings like UTC+02, and wrong-case spellings fail. On failure the field resets to config('app.timezone') and the save aborts.

Source

Thrown at app/Livewire/Server/Show.php:275

            $this->server->save();

            $this->server->settings->connection_timeout = $this->connectionTimeout;
            $this->server->settings->is_swarm_manager = $this->isSwarmManager;
            $this->server->settings->wildcard_domain = $this->wildcardDomain;
            $this->server->settings->is_swarm_worker = $this->isSwarmWorker;
            $this->server->settings->is_build_server = $this->isBuildServer;
            $this->server->settings->is_metrics_enabled = $this->isMetricsEnabled;
            $this->server->settings->sentinel_token = $this->sentinelToken;
            $this->server->settings->sentinel_metrics_refresh_rate_seconds = $this->sentinelMetricsRefreshRateSeconds;
            $this->server->settings->sentinel_metrics_history_days = $this->sentinelMetricsHistoryDays;
            $this->server->settings->sentinel_push_interval_seconds = $this->sentinelPushIntervalSeconds;
            $this->server->settings->sentinel_custom_url = $this->sentinelCustomUrl;
            $this->server->settings->is_sentinel_enabled = $this->isSentinelEnabled;
            $this->server->settings->is_sentinel_debug_enabled = $this->isSentinelDebugEnabled;

            if (! validate_timezone($this->serverTimezone)) {
                $this->serverTimezone = config('app.timezone');
                throw new \Exception('Invalid timezone.');
            } else {
                $this->server->settings->server_timezone = $this->serverTimezone;
            }

            $this->server->settings->save();
        } else {
            $this->name = $this->server->name;
            $this->description = $this->server->description;
            $this->ip = $this->server->ip;
            $this->user = $this->server->user;
            $this->port = $this->server->port;
            $this->connectionTimeout = $this->server->settings->connection_timeout;

            $this->wildcardDomain = $this->server->settings->wildcard_domain;
            $this->isReachable = $this->server->settings->is_reachable;
            $this->isUsable = $this->server->settings->is_usable;
            $this->isSwarmManager = $this->server->settings->is_swarm_manager;
            $this->isSwarmWorker = $this->server->settings->is_swarm_worker;

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Use an IANA identifier from PHP's list, e.g. 'Europe/Berlin' or 'UTC'
  2. Pick from DateTimeZone::listIdentifiers() output to guarantee a match
  3. If scripting, validate first: php artisan tinker --execute 'var_dump(in_array("Europe/Berlin", timezone_identifiers_list()));'
  4. After a failure, re-enter the timezone - the field was reset to the app default

Example fix

// before
$this->serverTimezone = 'CET';

// after
$this->serverTimezone = 'Europe/Budapest';
Defensive patterns

Strategy: validation

Validate before calling

if (! validate_timezone($timezone)) {
    // pick from timezone_identifiers_list() before submit
}

Type guard

/** @param mixed $tz */
function isValidTimezone($tz): bool
{
    return is_string($tz) && in_array($tz, timezone_identifiers_list(), true);
}

Try / catch

Catch \Exception in submit via handleError($e, $this); the field resets to config('app.timezone') on failure, so re-enter an IANA identifier and save again.

Prevention

When it happens

Trigger: Entering 'CET', 'GMT+2', 'utc', an empty string, or 'America/New York' (space) instead of 'America/New_York'; hand-typed values in the timezone field rather than picking from the list.

Common situations: Users abbreviating timezones from habit; values copied from TZ-unaware tools; JS Intl output (like 'UTC+02:00') pasted into the field.

Related errors


AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17). Data as JSON: /api/errors/2e7bf920231c2eae. Report an issue: GitHub.