BabylonJS/Babylon.js · error

No URL provided

Error message

No URL provided

What it means

AdvancedDynamicTexture._LoadURLContentAsync (shared by ParseFromURLAsync / snippet loading) rejects an empty string URL before issuing a WebRequest. The library cannot make an HTTP request without a URL, so it throws eagerly rather than failing inside the network layer.

Source

Thrown at packages/dev/gui/src/2D/advancedDynamicTexture.ts:1546

        const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(url);
        adt.parseSerializedObject(serialized, scaleToSize, urlRewriter);
        return adt;
    }

    /**
     * Recreate the content of the ADT from a url json
     * @param url defines the url to load
     * @param scaleToSize defines whether to scale to texture to the saved size
     * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
     * @returns a promise that will resolve on success
     */
    public async parseFromURLAsync(url: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture> {
        return await AdvancedDynamicTexture.ParseFromFileAsync(url, scaleToSize, this, urlRewriter);
    }

    private static async _LoadURLContentAsync(url: string, snippet: boolean = false): Promise<any> {
        if (url === "") {
            throw new Error("No URL provided");
        }

        return await new Promise((resolve, reject) => {
            const request = new WebRequest();
            request.addEventListener("readystatechange", () => {
                if (request.readyState == 4) {
                    if (request.status == 200) {
                        let gui;
                        if (snippet) {
                            const payload = JSON.parse(JSON.parse(request.responseText).jsonPayload);
                            gui = payload.encodedGui ? new TextDecoder("utf-8").decode(DecodeBase64ToBinary(payload.encodedGui)) : payload.gui;
                        } else {
                            gui = request.responseText;
                        }
                        const serializationObject = JSON.parse(gui);
                        resolve(serializationObject);
                    } else {
                        // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Pass a non-empty URL: check the value before calling, e.g. if (!url) throw/log before invoking parseFromURLAsync.
  2. Fix the source of the empty string (config key, env var, DOM attribute, path join) that produced "".
  3. Provide a default/fallback GUI asset URL when the primary one is missing.

Example fix

// before
const url = config.guiUrl; // may be ""
await AdvancedDynamicTexture.ParseFromURLAsync(url);

// after
const url = config.guiUrl;
if (!url) {
    throw new Error("config.guiUrl is not set");
}
await AdvancedDynamicTexture.ParseFromURLAsync(url);
Defensive patterns

Strategy: validation

Validate before calling

if (typeof url !== "string" || url.trim() === "") {
    throw new Error("GUI asset URL must be a non-empty string");
}
await AdvancedDynamicTexture.ParseFromURLAsync(url);

Type guard

function isNonEmptyUrl(v: unknown): v is string {
    return typeof v === "string" && v.trim().length > 0;
}

Try / catch

try {
    await AdvancedDynamicTexture.ParseFromURLAsync(url);
} catch (e) {
    if (e instanceof Error && e.message === "No URL provided") {
        console.error("GUI asset URL is empty — check config/env");
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling AdvancedDynamicTexture.ParseFromURLAsync(url) or parseFromURLAsync(url) with an empty string ("") — often the result of an unset config value, an empty dataset attribute, or a failed path-joining/template interpolation.

Common situations: Loading a .gui/.json snippet file where a base-URL config or environment variable is empty; dynamic asset paths computed from user data that ended up blank; build pipelines stripping the asset URL.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/000c5367aeb8a8f9. Report an issue: GitHub.