Kareadita/Kavita · error · KavitaException

generic-error

generic-error

Error message

generic-error

What it means

Catch-all 'something went wrong' for the server-settings update pipeline. After validating individual fields, SettingsService commits the unit of work and runs post-commit side effects (Hangfire rescheduling, stats tasks, bookmark-directory move, OIDC config swap, folder-watcher restart); if any of those throws, it logs the original exception, rolls back the transaction, and rethrows KavitaException('generic-error'). SettingsController catches this KavitaException and returns HTTP 400 with 'Something went wrong, please try again'. The real cause is in the server log, not the response.

Source

Thrown at Kavita.Services/SettingsService.cs:521

                    Secret = updateSettingsDto.OidcConfig.Secret,
                    CustomScopes = updateSettingsDto.OidcConfig.CustomScopes,
                };
            }

            if (updateSettingsDto.EnableFolderWatching)
            {
                BackgroundJob.Enqueue(() => libraryWatcher.StartWatching());
            }
            else
            {
                BackgroundJob.Enqueue(() => libraryWatcher.StopWatching());
            }
        }
        catch (Exception ex)
        {
            logger.LogError(ex, "There was an exception when updating server settings");
            await unitOfWork.RollbackAsync(ct);
            throw new KavitaException("generic-error");
        }


        logger.LogInformation("Server Settings updated");

        return updateSettingsDto;
    }

    public async Task<AuthorityValidationResult> IsValidAuthority(string authority, CancellationToken ct = default)
    {
        if (string.IsNullOrEmpty(authority))
        {
            return AuthorityValidationResult.NotApplicable;
        }

        if (!_isDevelopment && !authority.StartsWith("https"))
        {
            return AuthorityValidationResult.MissingHttps;

View on GitHub (pinned to 9c3e540000)

Solutions

  1. Read the server log around the timestamp for the logged original exception (message 'There was an exception when updating server settings') — the response message is intentionally generic.
  2. Verify free disk space and write permissions on the DB, cache, bookmark, and temp directories.
  3. Ensure the DB file is not locked by another process (AV scan, shadow copy, second Kavita instance).
  4. Retry the save once the underlying resource is available; if it reproduces, isolate which setting triggers it by saving fields in smaller batches.
  5. For bookmark-directory moves, confirm the target is writable and on the same volume to avoid copy failures.
Defensive patterns

Strategy: try-catch

Try / catch

// generic-error is a server fault; the real cause is in the server log.
async function saveSettings(dto: ServerSettings) {
  try {
    return await api.post('/api/settings', dto);
  } catch (e) {
    // 400 with translated 'Something went wrong' = transient/persistent server issue.
    notify('Could not save settings. Check server logs, disk space, and DB access.');
    throw e;
  }
}

Prevention

When it happens

Trigger: POST /api/settings where unitOfWork.CommitAsync fails or any post-commit step throws: DB constraint/locked-file/disk-full on commit, bookmark-directory CheckWriteAccess passing but the subsequent copy/delete failing (permissions, missing source), OIDC in-memory config assignment throwing, BackgroundJob.Enqueue failing, or TaskScheduler.ScheduleTasks/CancelStatsTasks erroring.

Common situations: SQLite DB file locked (e.g. AV/backup touching it on Windows); disk full so commit/copy fails; bookmark directory on a read-only or unmounted volume; Hangfire storage misconfigured; folder watcher throwing on a library path; partial OIDC config that passed validation but broke runtime assignment.

Related errors


AI-assisted analysis of Kareadita/Kavita@9c3e540000 (2026-08-13). Data as JSON: /api/errors/637d817b534cd449. Report an issue: GitHub.