nextcloud/all-in-one · error · Error

Error while fetching log data!

Error message

Error while fetching log data!

What it means

Thrown by the LogViewer class of the Nextcloud AIO web interface when the browser fetch() to 'api/docker/logs?id=<containerId>&since=<ts>' returns a non-2xx HTTP status (response.ok === false). That endpoint is served by the AIO mastercontainer's PHP backend (DockerController::GetLogs), which answers 200 even for unknown container ids, so a non-2xx status means the request never reached the log handler successfully: the mastercontainer or its Apache container is down/restarting, authentication middleware rejected the session, or a reverse proxy in front returned 502/503. The promise chain catches the error and logs it to the browser console; the 5-second autoload interval keeps retrying, so single occurrences are usually transient.

Source

Thrown at php/public/log-load.js:74

    debug(...args) {
        if (this.debugLog) {
            console.debug('LogViewer:', ...args);
        }
    }

    // Load log data and append it to the DOM.
    loadAndAppendLogData() {
        if (this.dataLoadingLock) {
            this.debug("Another log data loading request is still running, cancelling this request");
            return;
        }
        this.debug("Loading new log data");
        this.dataLoadingLock = true;
        this.loaderElem.classList.remove('hidden');
        fetch(this.getUrl())
            .then((response) => {
                if (!response.ok) {
                    throw new Error("Error while fetching log data!");
                }
                return response;
            })
            .then((response) => response.text())
            .then((text) => {
                text = text.trim();
                if (text.length === 0) {
                    this.debug("Received no new log data from server");
                    return;
                }
                this.debug("Received", Math.round(text.length / 1024), "KB of new log data from server");
                this.logElem.append(text + "\n");
                this.scrollToBottom();
                this.lastLogTimestamp = text.split("\n").at(-1)?.split(' ')[0] ?? '';
            })
            .finally(() => {
                this.dataLoadingLock = false;
                this.loaderElem.classList.add('hidden');

View on GitHub (pinned to 6b788eec5e)

Solutions

  1. Wait for the next 5-second poll — the viewer retries automatically and usually self-heals; check whether the console error repeats
  2. Verify the containers are up: 'sudo docker ps' and 'sudo docker logs -f nextcloud-aio-mastercontainer' (the mastercontainer and its Apache container must be running)
  3. Reload the log page (and re-login if the session expired) so a fresh authenticated fetch is made
  4. If the interface sits behind a reverse proxy, inspect its logs for 502/503 and fix the upstream to the mastercontainer

Example fix

// before
if (!response.ok) {
    throw new Error("Error while fetching log data!");
}
// after
if (!response.ok) {
    throw new Error(`Error while fetching log data! (HTTP ${response.status} ${response.statusText})`);
}
Defensive patterns

Strategy: retry

Validate before calling

// Cheap pre-check inside loadAndAppendLogData() before fetch():
if (!navigator.onLine) {
    this.debug('Browser offline, skipping log fetch');
    return;
}

Type guard

/**
 * @param {unknown} err
 * @returns {boolean} true when the failure was the HTTP-status check (not a network error)
 */
function isHttpError(err) {
    return err instanceof Error && err.message === 'Error while fetching log data!';
}

Try / catch

.catch((err) => {
    console.error(err);
    // The finally-block already released dataLoadingLock and hid the loader,
    // so no state is stuck; the 5 s autoload interval retries automatically.
    // Optionally count consecutive failures and stop autoloading after N.
})

Prevention

When it happens

Trigger: Opening the container-logs page while the nextcloud-aio-mastercontainer or its Apache container is restarting; the PHP backend dying mid-poll so the next fetch gets 5xx; an expired/invalid session cookie so auth middleware answers 401; a reverse proxy or CDN in front of the AIO interface briefly returning 502/503; transient network loss between browser and server.

Common situations: Watching logs during a container update or restart; browser tab left open overnight while the server reboots; AIO interface behind a reverse proxy whose upstream is briefly down; laptop resuming from sleep with stale connections.

Related errors


AI-assisted analysis of nextcloud/all-in-one@6b788eec5e (2026-08-21). Data as JSON: /api/errors/d2c3c77e508397f0. Report an issue: GitHub.