Orbmu2k/nvidiaProfileInspector · error · NvapiException

DRS_LoadSettings

Error message

DRS_LoadSettings

What it means

NvapiException wrapping a non-NVAPI_OK status from DRS_LoadSettings. It fires inside the global DRS session bootstrap in DrsSessionScope: after DRS_CreateSession succeeds, the driver-settings store is loaded so the session reflects current on-disk settings; if the driver query fails (driver not installed, NVIDIA driver API unavailable, or the settings store could not be read), the status is wrapped and thrown, aborting the session before any caller action runs.

Solutions

  1. Reboot or restart the display driver to release locks on the settings store
  2. Reinstall/update the NVIDIA driver to rebuild the settings database
  3. Run the app elevated to rule out permission issues on the driver store
  4. Retry the operation — transient failures can occur during driver updates
  5. Catch NvapiException and log the status to distinguish NVAPI_ERROR from NVAPI_EXECUTABLE etc.

Example fix

// before
DrsSession(hSession => SaveSettings(hSession));
// after
try { DrsSession(hSession => SaveSettings(hSession)); }
catch (NvapiException ex) when (ex.Status == NvAPI_Status.NVAPI_ERROR)
{
    RetryAfterDelay(() => DrsSession(hSession => SaveSettings(hSession)));
}
Defensive patterns

Strategy: retry

Validate before calling

static bool DriverStoreLikelyReady() =>
    Process.GetProcessesByName("nvxdsync").Length >= 0 && !IsDriverInstalling(); // plus admin check if needed

Try / catch

try
{
    DrsSession(h => SaveSettings(h));
}
catch (NvapiException ex) when (ex.Message == "DRS_LoadSettings")
{
    await Task.Delay(1000);
    DrsSession(h => SaveSettings(h)); // single retry
}

Prevention

When it happens

Trigger: After the global session is created in DrsSession, nvw.Instance.DRS_LoadSettings(GlobalSession) returns non-NVAPI_OK, raising this at DrsSessionScope.cs:39. Only occurs when preventLoadSettings is false (the default global path).

Common situations: Corrupted or locked driver settings store (nvdrsdb); driver update in progress or just replaced driver files; restricted user permissions on the driver settings store; rare transient driver API failure.

Related errors


AI-assisted analysis of Orbmu2k/nvidiaProfileInspector@2f50c388b3 (2026-09-15). Data as JSON: /api/errors/48634d495df3b9c2. Report an issue: GitHub.

Appendix: source

Thrown at nvidiaProfileInspector/Common/DrsSessionScope.cs:39

                if (!HoldSession || forceNonGlobalSession)
                    return NonGlobalDrsSession<T>(action, preventLoadSettings);


                if (GlobalSession == IntPtr.Zero)
                {

#pragma warning disable CS0420
                    var csRes = nvw.Instance.DRS_CreateSession(ref GlobalSession);
#pragma warning restore CS0420

                    if (csRes != NvAPI_Status.NVAPI_OK)
                        throw new NvapiException("DRS_CreateSession", csRes);

                    if (!preventLoadSettings)
                    {
                        var nvRes = nvw.Instance.DRS_LoadSettings(GlobalSession);
                        if (nvRes != NvAPI_Status.NVAPI_OK)
                            throw new NvapiException("DRS_LoadSettings", nvRes);
                    }
                }
            }

            if (GlobalSession != IntPtr.Zero)
            {
                return action(GlobalSession);
            }

            throw new Exception(nameof(GlobalSession) + " is Zero!");
        }

        public static void DestroyGlobalSession()
        {
            lock (_Sync)
            {
                if (GlobalSession != IntPtr.Zero)
                {

View on GitHub (pinned to 2f50c388b3)