Skip to content

Gotchas

These are the mistakes that bite most often when people extend KnowledgeLake, grouped by surface and roughly in order of how often they bite. Each one starts with what you see, then the cause and the fix. For an exact error text, see the Error message index.

At a glance

  • The top three Routing values written only on documents, metadata values treated as numbers, and an API token missing one feature
  • Also watch Behaviors run on the server in Start QC Task too; secret global variables are readable from workflow JavaScript; Jobs and RPA API filters with uneven case and time zone rules; event delivery gaps
  • Each entry Symptom, cause, fix, link

Summary

Symptom Surface
Every work item takes the default route Custom Step
A value you just set reads back as the old value Custom Step
A loop skipped half the documents Custom Step
parseFloat returns NaN Any script
A sample from the old help site does not run Custom Step
Copying a document to another work item fails Custom Step
The release step finds no content type Upload To Destination
A secret value shows up in metadata or a log Global variables
A behavior changes values in a workflow step Behaviors on the server
The behavior sets nothing Index panel
A lookup misses a value typed in another case Index panel
Call External API fails at once Call External API
Call External API reports success, and nothing changed Your own endpoint
The step timed out, but the function log shows success Your own endpoint
The function ran twice and the values doubled Your own endpoint
A PUT, PATCH or DELETE step fails Call External API
The function fails on its first call Azure Functions
The token is null in the debugger Local development
Success: false and no message REST API
HTTP 412 after a token rotation, or on some work items REST API
The API returns Id, the script uses DocumentId REST API
Testing in a browser runs as you, not as the token REST API
The Intuitive AI API returns HTTP 401 with a valid token REST API
QueryWorkState does not find a work item REST API
A job name finds runs but no history Jobs API
QueryForLatestRPATasks finds nothing or refuses a filter RPA API
Events you expected never arrive Events
A Custom Event step succeeds but no event arrives Events

Custom Step and workflow scripts

Every work item takes the default route

  • Cause The script set the routing value on each document. Routes read work item metadata only.
  • Fix Also write the value at the work item level: builder.SetBatchMetadata("Index", "NeedsReview", "Yes"). Through the API, use UpsertWorkItemMetadata.
  • Related Workflow routes

A value you just set reads back as the old value

  • Cause builder calls are queued and apply when the script ends. batch still holds the values from the start of the run.
  • Fix Keep the new value in a variable. If you must read the applied result in the same run, call builder.ApplyChanges(); it applies the queue and reloads batch and workItem.
  • Related Custom Step reference

A loop skipped half the documents

  • Cause builder.ApplyChanges() inside a loop over batch.Documents. It reloads batch, so the list your loop walks changes under it.
  • Fix Collect the document ids first, loop over that copy, and call ApplyChanges() once after the loop, or not at all.
  • Related Custom Step reference

parseFloat returns NaN

  • Cause Every metadata value is a string, and extracted amounts often keep $, , or spaces.
  • Fix Strip them first: parseFloat(String(value || "").replace(/[^0-9.\-]/g, "")) || 0.
  • Related Common JavaScript errors

A sample from the old help site does not run

  • Cause Many old samples were written for Process Designer: SetDocumentMetadata(bucket, key, value) with three arguments, logger, http, and Context with a capital C.
  • Fix Use the current signatures in the Custom Step reference: builder.SetDocumentMetadata(documentId, bucket, key, value).
  • Related Common JavaScript errors

Copying a document to another work item fails

  • Symptom Copying a document into another work item fails with Target work item does not exist.
  • Cause CopyDocumentToWorkItem and MoveDocumentToWorkItem accept only a work item that the same script created with builder.CreateWorkItem(name).
  • Fix Create the target in the script, or move documents into an existing work item from your own code through the API.
  • Related Error message index

The release step finds no content type

  • Symptom The release step says the document has no assigned content type.
  • Cause Upload To Destination reads General.DocTypeId (the content type's internal id). A key named ContentType or ContentTypeId does not choose the destination.
  • Fix Use builder.SetContentType(documentId, contentTypeId) in a Custom Step (it writes both DocTypeId and ContentTypeId), or set General.DocTypeId when you add the document through the API.
  • Related Find where a released document landed

A secret value shows up in metadata or a log

  • Symptom A secret global variable's value shows up in metadata, an event or a log.
  • Cause Routes, step setting preprocessors and Custom Steps can read a secret variable's value. A script that copies it into metadata, a Custom Event property or a request body exposes it to everyone who can read those.
  • Fix Use a secret only where it must go (for example an HTTP header in Call External API). Never write it to metadata or an event. Review scripts that read secrets.
  • Related Workflow global variables

Index panel behaviors

A behavior changes values in a workflow step

  • Symptom A behavior changes values in a workflow step that you did not expect.
  • Cause Custom Behaviors also run on the server, with context.app = "worker" and an empty user.
  • Where The Index Your Documents, Run Indexing Behaviors and Start QC Task steps (Start QC Task runs them when Mark Valid Documents as Indexed is on, the default), and Search bulk edit.
  • Fix Guard browser-only logic: if (context.app === "worker") { return; }. Do not rely on context.username on the server.
  • Related Custom Behaviors introduction

The behavior sets nothing

  • Symptom The behavior sets nothing and the field shows "Behavior Custom Behavior could not be fired."
  • Cause The script uses Context with a capital C (copied from old documentation), so it throws ReferenceError: Context is not defined.
  • Fix Use context.username, all lowercase. Open the browser console (F12) to see the exact error.
  • Related Debugging Custom Index Behaviors

A lookup misses a value typed in another case

  • Symptom A lookup finds nothing when the value is typed in another case.
  • Cause Reported by customers: SQL lookups match case-sensitively.
  • Fix Normalize the case of the key field in a behavior before the lookup runs.
  • Related Debugging Custom Index Behaviors

Call External API and your own endpoint

Call External API fails at once

  • Symptom The step fails at once with Api domain is not valid.
  • Cause The URL points at localhost or a private address. The step refuses it before it sends anything.
  • Fix Deploy the endpoint to a public HTTPS host first. Debug locally with a hard-coded work item id in a debug build.
  • Related Debugging Call External API and functions

Call External API reports success, and nothing changed

  • Cause Your endpoint caught an exception and still returned HTTP 200.
  • Fix Return 4xx or 5xx on any failure. The step then fails, and ApiResults.LastHttpStatusCode holds your status code for a route.
  • Related Your own endpoint

The step timed out, but the function log shows success

  • Cause The work took longer than the step's Timeout setting (0 means 15 minutes). The step stopped waiting; the function went on and finished.
  • Fix Set the step timeout longer than the function's worst-case run time. Make the function faster, or split the work.
  • Platform limits Keep the function under its platform limit. Azure Functions Consumption plan: 5 minutes by default for a run, and an HTTP-triggered function must answer within 230 seconds. API Gateway in front of Lambda: 29 seconds.
  • Related Your own endpoint

The function ran twice and the values doubled

  • Cause The step ran again (after a timeout, an error and a resubmit) and the code added to a value instead of setting it.
  • Fix Upsert fixed values. Never append to a value or increment a counter based on what is there.
  • Holds If the function releases a hold, treat No hold was found for workitem {id} as "already done".
  • Related Your own endpoint

A PUT, PATCH or DELETE step fails

  • Cause Call External API lists those verbs but runs only GET and POST.
  • Fix Use POST. Put your own endpoint in between if the target needs another verb.
  • Related Call External API

The function fails on its first call

  • Symptom The function fails on its first call with System.Linq, Version=8.0.0.0.
  • Cause An Azure Function on .NET 8 in-process without the setting that enables it.
  • Fix App setting FUNCTIONS_INPROC_NET8_ENABLED = 1, in Azure and in local.settings.json.
  • Related Your own endpoint

The token is null in the debugger

  • Cause Visual Studio or the terminal started before you set the environment variable.
  • Fix Restart Visual Studio or the terminal after you set it.
  • Related Authentication

REST API

Success: false and no message

  • Cause Your code reads Message, which does not exist. The text is in MessageKey or Messages[].MessageKey. Behind it there is usually a missing token feature (HTTP 401).
  • Fix Print the HTTP status and MessageKey. Add the feature to the token on Configuration > Services > API Access, or give the user the permission in Configuration > Permissions > API Access.
  • Related API introduction

HTTP 412 after a token rotation, or on some work items

  • Symptom HTTP 412 after a token rotation, or on some work items only.
  • Cause HTTP 412 is an application error, not an authentication error. A bad or deleted token gives HTTP 401.
  • After a token change A 412 points at the rest of the request: the work item id, a document id, or the body.
  • On some items only It often means a workflow step holds the work item at that moment.
  • Fix Read Messages[].MessageKey; the text after Root message: names the problem. For a locked work item, wait and retry with a growing delay.
  • Related Error message index

The API returns Id, the script uses DocumentId

  • Cause The API projection names a document's id Id. Custom Steps, routes and Liquid call it DocumentId.
  • Fix Map the names when you move code between surfaces.
  • Related KWorkItem API reference

Testing in a browser runs as you, not as the token

  • Cause A KnowledgeLake session cookie takes priority over the TempIdentityToken header.
  • Fix Test from a script, a REST client or a private browser window.
  • Related Authentication

The Intuitive AI API returns HTTP 401 with a valid token

  • Cause The token does not have the feature named Manage Learn Fingerprints, which the Intuitive AI API uses.
  • Fix Edit the token and select that feature.
  • Related Authentication

QueryWorkState does not find a work item

  • Symptom QueryWorkState does not find a work item you know exists.
  • Cause It returns only work items in workflows the token's user can run. A work item never sent to a workflow is not included.
  • Filter MetadataKeyFilter looks only in the Index bucket, with an exact value.
  • Fix Give the user Run permission on the workflow, or keep a list of the ids your code created.
  • Related KWorkItem API reference

A job name finds runs but no history

  • Cause V1_JobsAPI/QueryForJobRuns compares JobDisplayName without case; QueryForJobHistories compares it with case.
  • Fix Filter history by JobID (the JobID from QueryForJobRuns), not by name.
  • Related Jobs, RPA and Monitoring API

QueryForLatestRPATasks finds nothing or refuses a filter

  • Symptom QueryForLatestRPATasks returns nothing for a time window, or refuses a filter.
  • Cause LastUpdateTimeAfter is compared exactly as sent, with no conversion to or from UTC. A BotName or Automation that matches nothing, or a blank Process, is rejected, not ignored.
  • Fix Send the time in the zone the tasks were recorded in, or widen the window. Take bot and automation names from a previous result.
  • Related Jobs, RPA and Monitoring API

Events

Events you expected never arrive

  • Symptom Events you expected never arrive in your event store.
  • Cause Several event families never reach a provider set up in the UI, even with every category ticked. Delivery is also best effort: events queued in a process that restarts are lost.
  • Not delivered Insight, Tasks app actions, the class builders, Monitor RPA actions, upload profiles, Portal administration, Intuitive AI engine errors, Write Event API events and everything from the Tasks service.
  • Fix Check the event's entry in the Events Dictionary before you build on it. For your own business events, use a Custom Event step. Do not treat a missing event as proof that nothing happened.
  • Related Events and the Secondary Event Provider

A Custom Event step succeeds but no event arrives

  • Cause The tenant has no Secondary Event Provider, its Custom category is unticked, or the step runs on the legacy worker (a Process Designer process), which does not forward custom events.
  • Fix Open Configuration > Apps > Event Settings, edit the provider, and tick Custom. Use the step in a Workflow designer workflow.
  • Related Custom Event step