{"record":{"id":"e3d9f2df7ce4086e","repo":"hcengineering/platform","slug":"process-error-methodnotfound","errorCode":"process.error.MethodNotFound","errorMessage":"Method not found: {methodId}","messagePattern":"Method not found: (.+?)","errorType":"exception","errorClass":"ProcessError","httpStatus":null,"severity":"error","filePath":"server-plugins/process-resources/src/utils.ts","lineNumber":117,"sourceCode":"        {},\n        { attr: attr?.label ?? getEmbeddedLabel(context.key) }\n      )\n    }\n    return val\n  } else {\n    throw processError(process.error.ObjectNotFound, { _id: execution.card }, {}, true)\n  }\n}\n\nasync function fillValue (\n  value: any,\n  context: SelectedContext,\n  control: ProcessControl,\n  execution: Execution\n): Promise<any> {\n  for (const func of context.functions ?? []) {\n    const transform = control.client.getModel().findObject(func.func)\n    if (transform === undefined) throw processError(process.error.MethodNotFound, { methodId: func.func }, {}, true)\n    if (!control.client.getHierarchy().hasMixin(transform, serverProcess.mixin.FuncImpl)) {\n      throw processError(process.error.MethodNotFound, { methodId: func.func }, {}, true)\n    }\n    const funcImpl = control.client.getHierarchy().as(transform, serverProcess.mixin.FuncImpl)\n    const f = await getResource(funcImpl.func)\n    value = await f(value, func.props, control, execution)\n  }\n  return value\n}\n\nasync function getNestedValue (control: ProcessControl, execution: Execution, context: SelectedNested): Promise<any> {\n  const card = control.cache.get(execution.card)\n  if (card === undefined) throw processError(process.error.ObjectNotFound, { _id: execution.card }, {}, true)\n  const _process = control.client.getModel().findObject(execution.process)\n  if (_process === undefined) throw processError(process.error.ObjectNotFound, { _id: execution.process })\n  const realPath = resolveAttributeId(_process, context.path)\n  const attr = control.client.getHierarchy().findAttribute(card._class, realPath)\n  if (attr === undefined) throw processError(process.error.AttributeNotExists, { key: realPath })","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/server-plugins/process-resources/src/utils.ts#L99-L135","documentation":"Thrown by fillValue when a context function references an object (func.func) that findObject cannot resolve — the transform/method object does not exist in the model. Message includes the missing methodId.","triggerScenarios":"getContextValue → fillValue iterating context.functions where a function's func id points to a deleted or never-created object in the model.","commonSituations":"Process templates referencing functions removed during refactors/migrations; importing templates between workspaces where function objects were not exported; typo'd or stale object ids stored in context.functions.","solutions":["Look up the methodId in the model; recreate the missing function object or fix the reference.","Re-export/import the full template including all function objects so ids resolve.","Remove or update the stale entry in context.functions.","Add preflight validation of context.functions against the model before running the process step."],"exampleFix":"// before: blind iteration\nfor (const func of context.functions ?? []) { ... }\n// after: validate first\nconst missing = (context.functions ?? []).filter(f => control.client.getModel().findObject(f.func) === undefined)\nif (missing.length > 0) throw new Error('Unknown functions: ' + missing.map(f => f.func).join(', '))","handlingStrategy":"validation","validationCode":"const missing = (context.functions ?? [])\n  .map(f => f.func)\n  .filter(id => control.client.getModel().findObject(id) === undefined)\nif (missing.length > 0) throw new Error('Unknown function ids: ' + missing.join(', '))","typeGuard":"function isKnownFunction(control: ProcessControl, id: Ref<Doc>): boolean {\n  return control.client.getModel().findObject(id) !== undefined\n}","tryCatchPattern":"try {\n  const value = await getContextValue(ctx, control, execution)\n} catch (err) {\n  if ((err as Error).message.startsWith('Method not found')) {\n    // strip stale function from context.functions and retry\n  } else throw err\n}","preventionTips":["Include all function objects when exporting/importing templates","Validate function references when saving process templates","Clean up context.functions entries when functions are deleted","Pin template versions to avoid referencing removed functions"],"tags":["process","method-lookup","broken-reference"],"backgroundTag":"method-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}