{"record":{"id":"0b8035daf4a5d450","repo":"HangfireIO/Hangfire","slug":"could-not-get-a-value-of-the-job-parameter-name-0b8035","errorCode":null,"errorMessage":"Could not get a value of the job parameter `{name}`. See inner exception for details.","messagePattern":"Could not get a value of the job parameter `(.+?)`\\. See inner exception for details\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Server/PerformContext.cs","lineNumber":142,"sourceCode":"\n            try\n            {\n                string value;\n\n                if (allowStale && BackgroundJob.ParametersSnapshot != null)\n                {\n                    BackgroundJob.ParametersSnapshot.TryGetValue(name, out value);\n                }\n                else\n                {\n                    value = Connection.GetJobParameter(BackgroundJob.Id, name);                \n                }\n\n                return SerializationHelper.Deserialize<T>(value, SerializationOption.User);\n            }\n            catch (Exception ex) when (ex.IsCatchableExceptionType())\n            {\n                throw new InvalidOperationException(\n                    $\"Could not get a value of the job parameter `{name}`. See inner exception for details.\", ex);\n            }\n        }\n    }\n}\n","sourceCodeStart":124,"sourceCodeEnd":148,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Server/PerformContext.cs#L124-L148","documentation":"Thrown by PerformContext.GetJobParameter when reading or deserializing a job parameter fails for any catchable reason — the parameter doesn't exist (value null), the stored value can't deserialize to T, or the storage read throws. The original error is preserved as InnerException. This is the server-side performer context.","triggerScenarios":"Calling context.GetJobParameter<T>(name) inside a job or filter where the parameter was never set, was set with a different type, or the connection.GetJobParameter call fails. T must be deserializable from the stored user-serialized value.","commonSituations":"Reading a parameter that was never written (e.g. 'CoreBackgroundJobServerParameters' or a custom param). Type mismatch between writer and reader. Storage connectivity issue during parameter read. Corrupt serialized parameter.","solutions":["Ensure the parameter is set via context.SetJobParameter / SetJobParameter before reading it.","Match the type T exactly to the type used when the parameter was written.","Wrap GetJobParameter in try/catch (InvalidOperationException) and provide a default when the parameter is optional."],"exampleFix":"// before\nvar retry = context.GetJobParameter<int>(\"RetryCount\"); // throws if unset\n\n// after\nint retry;\ntry { retry = context.GetJobParameter<int>(\"RetryCount\"); }\ncatch (InvalidOperationException) { retry = 0; }","handlingStrategy":"try-catch","validationCode":"// Check whether the parameter exists before deserializing\nvar raw = context.Connection.GetJobParameter(context.BackgroundJob.Id, name);\nif (string.IsNullOrEmpty(raw)) return default;","typeGuard":null,"tryCatchPattern":"T value;\ntry { value = context.GetJobParameter<T>(name); }\ncatch (InvalidOperationException) { value = default; }","preventionTips":["Always SetJobParameter for any parameter a job/filter will later read.","Use matching types when writing and reading parameters.","Guard optional-parameter reads with try/catch and a default."],"tags":["job-parameter","performer","invalid-operation","server"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}