appwrite/appwrite · error · Exception

' ' not found.

Error message

'{$arch}' not found.

What it means

isArch() validates a CPU architecture against the class constants (X86, PPC, ARM64, ARMV7, ARMV8). If the passed string is not one of the known constants, the match expression's default branch throws "'{$arch}' not found." — an unknown-architecture error, not a detection failure.

Solutions

  1. Use the class constants (System::X86, System::ARM64, ...) instead of raw strings
  2. Map raw uname/GoArch-style names to the constants before calling isArch()
  3. Catch the exception or validate membership against the constants list first

Example fix

// before
System::isArch('x86_64'); // throws
// after
System::isArch(System::X86); // uses the library's constant
Defensive patterns

Strategy: validation

Validate before calling

$valid = in_array($arch, [System::X86, System::PPC, System::ARM64, System::ARMV7, System::ARMV8], true);

Type guard

function isValidArch(string $arch): bool { return in_array($arch, [System::X86, System::PPC, System::ARM64, System::ARMV7, System::ARMV8], true); }

Try / catch

try { $ok = System::isArch($arch); } catch (\Exception $e) { $ok = false; log("Unknown arch: $arch"); }

Prevention

When it happens

Trigger: Calling System::isArch('amd64') or any string that is not one of the exported architecture constants; typo'd architecture names; passing php_uname('m') output directly instead of mapping it to a constant.

Common situations: Hardcoding architecture strings that don't match constants ('x86_64' vs X86, 'aarch64' vs ARM64); user/config-supplied arch values; scripts iterating over arch lists with stale names.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of appwrite/appwrite@7eab5f1970 (2026-09-23). Data as JSON: /api/errors/38e4a1f2280c38c5. Report an issue: GitHub.

Appendix: source

Thrown at packages/system/src/System.php:763

        return (bool) preg_match(self::RegExPPC, self::getArch());
    }

    /**
     * Checks if the system is the passed architecture.
     * You should pass `System::X86`, `System::PPC`, `System::ARM` or an equivalent string.
     *
     *
     * @throws Exception
     */
    public static function isArch(string $arch): bool
    {
        return match ($arch) {
            self::X86 => self::isX86(),
            self::PPC => self::isPPC(),
            self::ARM64 => self::isArm64(),
            self::ARMV7 => self::isArmV7(),
            self::ARMV8 => self::isArmV8(),
            default => throw new Exception("'{$arch}' not found."),
        };
    }
}

View on GitHub (pinned to 7eab5f1970)