hcengineering/platform · error
process:error:ContextValueNotProvided
process:error:ContextValueNotProvided
Error message
Context value not provided: {name} What it means
getExecutionContextValue exhausted all sources for a process-context value (processContext lookup by name/id) and found nothing, so it throws ContextValueNotProvided with the context name. The declared execution/process context was never populated.
Source
Thrown at server-plugins/process-resources/src/utils.ts:308
control: ProcessControl,
execution: Execution,
context: SelectedExecutionContext
): Promise<any> {
const userContext = execution.context[context.id]
const _process = control.client.getModel().findObject(execution.process)
const processContext = _process?.context?.[context.id]
if (userContext !== undefined) {
if (context.key == null || context.key === '' || context.key === '_id') return userContext
if (processContext !== undefined) {
const contextVal =
control.cache.get(userContext) ?? (await control.client.findOne(processContext?._class, { _id: userContext }))
if (contextVal !== undefined) {
const val = getValue(control, execution, context.key, contextVal)
return val
}
}
}
throw processError(process.error.ContextValueNotProvided, { name: processContext?.name ?? context.id })
}
View on GitHub (pinned to 63e28dc964)
Solutions
- Populate the execution context with the named value when starting/resuming the process
- Check that processContext?.name / context.id match the keys actually provided
- Verify upstream steps that set this context actually ran and succeeded
- Catch the error and supply a default or fail fast with a clear client message
Example fix
// before
process.start('ApprovalFlow', {}) // context missing
// after
process.start('ApprovalFlow', { context: { requester: currentUserId } }) Defensive patterns
Strategy: try-catch
Validate before calling
const name = processContext?.name ?? context.id
if (execution.context[name] === undefined) {
throw new Error(`execution context value '${name}' was not provided`)
} Type guard
function hasContextValue(ctx: Record<string, unknown>, key: string): boolean {
return ctx[key] !== undefined
} Try / catch
try {
val = await getContextValue(control, execution, context)
} catch (e) {
if (e?.code === 'process:error:ContextValueNotProvided') {
val = defaultContextValues[e.params?.name]
} else throw e
} Prevention
- Document and validate required context variables at process start
- Keep context key names in a shared constants module
- Propagate execution context on resume calls without dropping keys
When it happens
Trigger: No processContext entry matched and execution context had no value under context.id when getExecutionContextValue evaluated the context selector.
Common situations: Process started without the required context variables; context name changed in config but not at the call site; resume path drops context propagation; typo between context declaration and provider.
Related errors
- process.error.UserRequestedValueNotProvided
- process.error.RequiredParamsNotProvided
- process.error.ObjectNotFound
- process.error.ObjectNotFound
- process.error.EmptyAttributeContextValue
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/65e3a6e3d8aa1a00.
Report an issue: GitHub.