Orbmu2k/nvidiaProfileInspector · error · NvapiException
DRS_RestoreProfileDefault
Error message
DRS_RestoreProfileDefault
What it means
NvapiException wrapping a non-NVAPI_OK status from DRS_RestoreProfileDefault. It is raised by ResetProfile while resetting a profile inside a DRS session: GetProfileHandle/GetProfileInfo determined the profile is predefined (isPredefined == 1), so the code calls DRS_RestoreProfileDefault to restore the driver's factory version of that predefined profile; a failure status from the driver is wrapped and thrown, leaving the predefined profile unrestored.
Solutions
- Verify the NVIDIA driver is installed and the profile name exists before calling ResetProfile.
- Catch NvapiException around ResetProfile and surface the wrapped status to the caller instead of crashing.
- Retry the reset in a fresh DRS session, since a stale shared session handle can return errors.
- For non-predefined profiles, remove the profile rather than calling DRS_RestoreProfileDefault, which only applies to predefined ones.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at nvidiaProfileInspector/Common/DrsSettingsService.cs:262 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Orbmu2k/nvidiaProfileInspector@2f50c388b3 (2026-09-15).
Data as JSON: /api/errors/c72337c05ed11221.
Report an issue: GitHub.
Appendix: source
Thrown at nvidiaProfileInspector/Common/DrsSettingsService.cs:262
throw new NvapiException("DRS_RestoreAllDefaults", nvRes);
SaveSettings(hSession);
});
}
public void ResetProfile(string profileName, out bool removeFromModified)
{
bool tmpRemoveFromModified = false;
DrsSession((hSession) =>
{
var hProfile = GetProfileHandle(hSession, profileName);
var profile = GetProfileInfo(hSession, hProfile);
if (profile.isPredefined == 1)
{
var nvRes = nvw.Instance.DRS_RestoreProfileDefault(hSession, hProfile);
if (nvRes != NvAPI_Status.NVAPI_OK)
throw new NvapiException("DRS_RestoreProfileDefault", nvRes);
SaveSettings(hSession);
tmpRemoveFromModified = true;
}
else if (profile.numOfSettings > 0)
{
int dropCount = 0;
var settings = GetProfileSettings(hSession, hProfile);
foreach (var setting in settings)
{
if (setting.settingLocation == NVDRS_SETTING_LOCATION.NVDRS_CURRENT_PROFILE_LOCATION)
{
if (nvw.Instance.DRS_DeleteProfileSetting(hSession, hProfile, setting.settingId) == NvAPI_Status.NVAPI_OK)
{
dropCount++;
}
}
View on GitHub (pinned to 2f50c388b3)