{"record":{"id":"65e3a6e3d8aa1a00","repo":"hcengineering/platform","slug":"process-error-contextvaluenotprovided","errorCode":"process:error:ContextValueNotProvided","errorMessage":"Context value not provided: {name}","messagePattern":"Context value not provided: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server-plugins/process-resources/src/utils.ts","lineNumber":308,"sourceCode":"  control: ProcessControl,\n  execution: Execution,\n  context: SelectedExecutionContext\n): Promise<any> {\n  const userContext = execution.context[context.id]\n  const _process = control.client.getModel().findObject(execution.process)\n  const processContext = _process?.context?.[context.id]\n  if (userContext !== undefined) {\n    if (context.key == null || context.key === '' || context.key === '_id') return userContext\n    if (processContext !== undefined) {\n      const contextVal =\n        control.cache.get(userContext) ?? (await control.client.findOne(processContext?._class, { _id: userContext }))\n      if (contextVal !== undefined) {\n        const val = getValue(control, execution, context.key, contextVal)\n        return val\n      }\n    }\n  }\n  throw processError(process.error.ContextValueNotProvided, { name: processContext?.name ?? context.id })\n}\n","sourceCodeStart":290,"sourceCodeEnd":310,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/server-plugins/process-resources/src/utils.ts#L290-L310","documentation":"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.","triggerScenarios":"No processContext entry matched and execution context had no value under context.id when getExecutionContextValue evaluated the context selector.","commonSituations":"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.","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"],"exampleFix":"// before\nprocess.start('ApprovalFlow', {}) // context missing\n// after\nprocess.start('ApprovalFlow', { context: { requester: currentUserId } })","handlingStrategy":"try-catch","validationCode":"const name = processContext?.name ?? context.id\nif (execution.context[name] === undefined) {\n  throw new Error(`execution context value '${name}' was not provided`)\n}","typeGuard":"function hasContextValue(ctx: Record<string, unknown>, key: string): boolean {\n  return ctx[key] !== undefined\n}","tryCatchPattern":"try {\n  val = await getContextValue(control, execution, context)\n} catch (e) {\n  if (e?.code === 'process:error:ContextValueNotProvided') {\n    val = defaultContextValues[e.params?.name]\n  } else throw e\n}","preventionTips":["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"],"tags":["process","context","missing-value"],"backgroundTag":"missing-context-value","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}