hcengineering/platform · error · ProcessError

process.error.ObjectNotFound

process.error.ObjectNotFound

Error message

Object not found: {_id}

What it means

Thrown by getValue in server-plugins/process-resources when the process document referenced by execution.process cannot be found via control.client.getModel().findObject(). The process execution context points to a process object that no longer exists (or the model hasn't loaded it), so attribute resolution cannot proceed.

Solutions

  1. Verify execution.process points to an existing process object (query the model directly with the _id).
  2. Restore or recreate the missing process object, or delete/cancel the orphaned execution.
  3. Reload/refresh the client model to rule out incomplete model loading.
  4. Check for migrations or workspace cleanup that removed process objects referenced by live executions.

Example fix

// before: stale execution
const exec = { process: 'deleted-process-id', card: cardId }
const val = await getValue(control, exec, 'Status', card)
// after: validate process exists first
const proc = control.client.getModel().findObject(exec.process)
if (proc === undefined) throw new Error('Process missing: ' + exec.process)
const val = await getValue(control, exec, 'Status', card)
Defensive patterns

Strategy: validation

Validate before calling

const proc = control.client.getModel().findObject(execution.process)
if (proc === undefined) throw new Error('Process not found: ' + execution.process)

Type guard

function processExists(control: ProcessControl, id: Ref<Doc>): boolean {
  return control.client.getModel().findObject(id) !== undefined
}

Try / catch

try {
  const value = getValue(control, execution, key, card)
} catch (err) {
  if ((err as Error).message.includes('Object not found')) {
    // repair or cancel orphaned execution
  } else throw err
}

Prevention

When it happens

Trigger: Calling getContextValue/getAttributeValue/getValue for a control value where execution.process contains an _id that findObject on the model cannot resolve: the process object was deleted, the _id is stale/corrupted, or the model was not fully loaded/updated in this client.

Common situations: A process was deleted or migrated while executions referencing it still exist; working against a workspace snapshot/backup where process objects were purged; a frontend or automation passing an invalid process id into the process-resources plugin; model synchronization lag after upgrades.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/c11300e8c30886ea. Report an issue: GitHub.

Appendix: source

Thrown at server-plugins/process-resources/src/utils.ts:81

      value[key] = await getContextValue(value[key], control, execution)
    }
    return value
  } else {
    return value
  }
}

export function resolveAttributeId<T extends string> (_process: Process, key: T): T {
  if (_process.bindings?.[key] !== undefined) {
    return _process.bindings[key] as T
  }
  return key
}

function getValue (control: ProcessControl, execution: Execution, rawKey: string, card: Doc): any {
  const hierarchy = control.client.getHierarchy()
  const _process = control.client.getModel().findObject(execution.process)
  if (_process === undefined) throw processError(process.error.ObjectNotFound, { _id: execution.process })
  const realKey = resolveAttributeId(_process, rawKey)
  const key = checkMixinKey(realKey, _process.masterTag, hierarchy)
  return getObjectValue(key, card)
}

function getConstValue (control: ProcessControl, execution: Execution, context: SelectedConst): any {
  return context.value
}

function getAttributeValue (control: ProcessControl, execution: Execution, context: SelectedContext): any {
  const card = control.cache.get(execution.card)
  if (card !== undefined) {
    const val = getValue(control, execution, context.key, card)
    if (val == null) {
      const attr = control.client.getHierarchy().findAttribute(card._class, context.key)
      throw processError(
        process.error.EmptyAttributeContextValue,
        {},

View on GitHub (pinned to 63e28dc964)