Skip to content

make-pot fails without network: remote_get() doesn't catch the exception http_request() throws, so the bundled schemas are never used #518

Closed

Description

@wojtekpiskorz

wp i18n make-pot fetches block-i18n.json and theme-i18n.json from wordpress-develop's trunk, and is meant to fall back to the copies it bundles (JsonSchemaExtractor::THEME_JSON_FALLBACK and BLOCK_JSON_FALLBACK) when the fetch fails. remote_get() passes halt_on_error => false, and its docblock says it "Returns an empty string in case of error".

But on a transport error, WP_CLI\Utils\http_request() with halt_on_error false doesn't return a failed response. It throws a RuntimeException (wp-cli/wp-cli php/utils.php, both throw new RuntimeException( $error_msg, 0, $exception ) paths). remote_get() doesn't catch it, so make-pot aborts and the fallback is never used.

Steps to reproduce

  1. Use a plugin or theme with a block.json (or a theme.json).
  2. Run WP-CLI with the i18n command and no network, for example in a container started with docker run --network none. PHP without a CA bundle (php-wasm) hits the same path.
  3. Run wp i18n make-pot . languages/x.pot.

Expected

A debug message ("Failed to download from URL …"), extraction with the bundled schema, and the POT written.

Actual

make-pot stops with Failed to get url 'https://develop.svn.wordpress.org/trunk/src/wp-includes/block-i18n.json': … and writes nothing.

Seen with 2.7.0, and the code is the same on main.

Suggested fix

Catch RuntimeException around the http_request() call in remote_get() and return '', which already selects the fallback. A Behat scenario could run make-pot with the proxy set to an unreachable address.

For context: we run make-pot under php-wasm and in containers without network. Until this is fixed, we seed the extractor's schema cache with the bundled copies before make-pot runs (a --require file hooked on before_invoke:i18n make-pot).

Activity

  1. added a commit that references this issue on Nov 2, 2026
    cb2b6db
  2. added a commit that references this issue on Nov 3, 2026
    acde309
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions