{"record":{"id":"6535524c6334cea7","repo":"FlowiseAI/Flowise","slug":"failed-to-retrieve-value-errormessage","errorCode":null,"errorMessage":"Failed to retrieve value: ${errorMessage}","messagePattern":"Failed to retrieve value: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/AWSDynamoDBKVStorage/AWSDynamoDBKVStorage.ts","lineNumber":178,"sourceCode":"            if (result.Items.length < nthLatestNum) {\n                return JSON.stringify({\n                    value: null,\n                    timestamp: null\n                })\n            }\n\n            const item = result.Items[nthLatestNum - 1]\n            const value = item.value?.S || null\n            const timestamp = item.timestamp?.S || item.sk?.S || null\n\n            // Return JSON with value and timestamp\n            return JSON.stringify({\n                value: value,\n                timestamp: timestamp\n            })\n        } catch (error) {\n            const errorMessage = error instanceof Error ? error.message : String(error)\n            throw new Error(`Failed to retrieve value: ${errorMessage}`)\n        }\n    }\n}\n\n/**\n * Node implementation for AWS DynamoDB KV Storage tools\n */\nclass AWSDynamoDBKVStorage_Tools implements INode {\n    label: string\n    name: string\n    version: number\n    type: string\n    icon: string\n    category: string\n    description: string\n    baseClasses: string[]\n    credential: INodeParams\n    inputs: INodeParams[]","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/AWSDynamoDBKVStorage/AWSDynamoDBKVStorage.ts#L160-L196","documentation":"Thrown by DynamoDBRetrieveTool._call as a catch-all wrapper around any failure during a DynamoDB QueryCommand (send, item access, or field read). The original error message is interpolated, so the wrapped cause is always visible. It signals that a key-value retrieval against the configured table did not complete for a reason other than 'no item found' (which returns null JSON, not an error).","triggerScenarios":"Calling the retrieve tool with a key whose fullKey (prefix + '#' + key) exceeds DynamoDB limits, IAM/credentials lacking dynamodb:Query, a misconfigured table name, a malformed nthLatest value, or AWS throttling/network errors returned by dynamoClient.send().","commonSituations":"Wrong AWS region selected so the table does not exist; expired STS session token; the table was created without a sort key (sk) so the descending Query fails; a key containing characters that break KeyConditionExpression; rate limiting under heavy load.","solutions":["Read the interpolated errorMessage first — it names the real AWS SDK error (e.g. ResourceNotFoundException, AccessDeniedException, ValidationException) and dictates the fix.","Verify the table exists in the selected region and that the IAM principal has dynamodb:Query on arn:aws:dynamodb:<region>:*:table/<tableName>.","Confirm the table schema has a partition key 'pk' and a sort key 'sk' as the tool's QueryCommand assumes.","Retry on transient AWS errors (ThrottlingException, 5xx) with exponential backoff rather than treating them as permanent."],"exampleFix":"// before: credentials loaded once and never refreshed\nconst credentials = await getAWSCredentials(nodeData, options)\n// after: validate the principal can actually query the table at init time\nawait dynamoClient.send(new DescribeTableCommand({ TableName: tableName }))\n// surface a precise error before the tool ever runs","handlingStrategy":"try-catch","validationCode":"// Before invoking the tool, confirm the table is queryable\nimport { DescribeTableCommand } from '@aws-sdk/client-dynamodb'\nasync function assertTableQueryable(client: DynamoDBClient, name: string) {\n  try {\n    await client.send(new DescribeTableCommand({ TableName: name }))\n  } catch (e) {\n    throw new Error(`Table ${name} not usable: ${(e as Error).message}`)\n  }\n}","typeGuard":"function isAwsSdkError(e: unknown): e is { name: string; message: string; Code?: string } {\n  return typeof e === 'object' && e !== null && 'name' in e && typeof (e as any).name === 'string'\n}","tryCatchPattern":"try {\n  const out = await retrieveTool.invoke({ key: 'foo', nthLatest: '1' })\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e)\n  if (/Throttling|RequestLimitExceeded/.test(msg)) { /* backoff + retry */ }\n  else if (/ResourceNotFound/.test(msg)) { /* table missing */ }\n  else throw e\n}","preventionTips":["Run a DescribeTable probe at init time so failures surface before the first query.","Grant the IAM principal dynamodb:Query plus dynamodb:DescribeTable on the table ARN.","Implement exponential backoff on transient AWS errors rather than surfacing them to end users."],"tags":["aws","dynamodb","kv-storage","runtime","catch-all"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}