Skip to content

tf.loadGraphModel() returns HTTP 403 when loading models from TensorFlow Hub or Kaggle (browser, CDN, TF.js v2) #8595

@Eisei-tsk

Description

@Eisei-tsk

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js):
    No, using a minimal example as below
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
    macOS (desktop), iOS (Safari), Android (Chrome)
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
    iPhone (Safari), Android (Chrome) — both affected
  • TensorFlow.js installed from (npm or script link):
    Script link (CDN) – https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]
  • TensorFlow.js version (use command below):
    2.x (tested with 2.8.0, also reproducible on latest CDN version)
  • Browser version:
    Chrome (latest), Safari (latest)
  • TensorFlow.js Converter Version:
    Not applicable

Describe the current behavior
When loading TensorFlow.js v2 via CDN and using tf.loadGraphModel() to load a model hosted on TensorFlow Hub or Google Cloud Storage (Kaggle),
the request fails with an HTTP 403 Forbidden error.

This issue occurs in all tested environments (desktop and mobile, multiple browsers) and is reproducible 100% of the time.
It is independent of specific versions or custom code.

Example 1 — TensorFlow Hub

[Error] Failed to load resource: the server responded with a status of 403 () (model.json, line 0)
Error: Request to https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1/model.json?tfjs-format=file failed with status code 403.
Please verify this URL points to the model JSON of the model to load.
    at tensorflow_tfjs.js:17:435784
    at h (tensorflow_tfjs.js:17:2105)
    at anonymous (tensorflow_tfjs.js:17:3443)
    at u (tensorflow_tfjs.js:17:8325)
    at o (tensorflow_tfjs.js:17:8529)

Example 2 — Kaggle (Google Cloud Storage)

[Error] Failed to load resource: the server responded with a status of 403 () (model.json, line 0)
Request to https://storage.googleapis.com/kagglesdsdata/models/1586/1951/model.json?... failed with status code 403

The issue began recently (around October 2025) and did not occur previously with the same model URLs.

Describe the expected behavior
Models hosted publicly on TensorFlow Hub or Google Cloud Storage should load successfully in browser environments
via tf.loadGraphModel() when TensorFlow.js is imported through the CDN.

Standalone code to reproduce the issue
A minimal reproducible example (no custom code):

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>
<script>
  async function test() {
    const model = await tf.loadGraphModel(
      'https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1/model.json'
    );
    console.log('Model loaded:', model);
  }
  test();
</script>

Steps to reproduce:
1. Save the above HTML and open it in Chrome or Safari (desktop or mobile).
2. Observe the 403 Forbidden error in the console.

Also reproducible with this Kaggle-hosted model URL:
https://storage.googleapis.com/kagglesdsdata/models/1586/1951/model.json?... (signed URL)

Other info / logs

  • Reproducible on macOS, iOS, and Android
  • Tested combination: TensorFlow.js v2 + MobileNet v1
  • Affects TensorFlow Hub and Kaggle (Google Cloud Storage)
  • Happens regardless of TensorFlow.js version when loaded via CDN
  • Clearing browser cache, changing networks, or using different devices does not resolve the issue
  • Likely related to CORS / access policy changes on TensorFlow Hub or GCS
  • 100% reproducible
  • Prevents browser-based loading of public models via tf.js

Possible cause:

  • TensorFlow Hub and GCS may now reject tfjs-format=file or signed requests from browsers.
  • CORS headers or authentication requirements might have changed recently.
  • TensorFlow.js v2’s fetch behavior may not fully support legacy models (e.g., MobileNet v1).

Summary:
When using TensorFlow.js v2 from CDN, any attempt to load a model from TensorFlow Hub or Kaggle (Google Cloud Storage) results in an HTTP 403 error across all browsers and platforms.
This prevents model loading in browser environments even for publicly available models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions