{"record":{"id":"e8a0b155e62345c8","repo":"googleapis/mcp-toolbox","slug":"invalid-number-input-for-name-raw-value","errorCode":null,"errorMessage":"Invalid number input for ${NAME}: ${RAW_VALUE}","messagePattern":"Invalid number input for (.+?): (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"internal/server/static/js/runTool.js","lineNumber":63,"sourceCode":"            if (VALUE_TYPE === 'boolean') {\n                typedParams[NAME] = RAW_VALUE !== null;\n                console.debug(`Parameter ${NAME} (boolean) set to: ${typedParams[NAME]}`);\n                continue; \n            }\n\n            // process remaining types\n            if (VALUE_TYPE && VALUE_TYPE.startsWith('array<')) {\n                typedParams[NAME] = parseArrayParameter(RAW_VALUE, VALUE_TYPE, NAME);\n            } else {\n                switch (VALUE_TYPE) {\n                    case 'number':\n                        if (RAW_VALUE === \"\") {\n                            console.debug(`Param ${NAME} was empty, setting to empty string.`)\n                            typedParams[NAME] = \"\";\n                        } else {\n                            const num = Number(RAW_VALUE);\n                            if (isNaN(num)) {\n                                throw new Error(`Invalid number input for ${NAME}: ${RAW_VALUE}`);\n                            }\n                            typedParams[NAME] = num;\n                        }\n                        break;\n                    case 'string':\n                    default:\n                        typedParams[NAME] = RAW_VALUE;\n                        break;\n                }\n            }\n        } catch (error) {\n            console.error('Error processing parameter:', NAME, error);\n            responseArea.value = `Error for ${NAME}: ${error.message}`;\n            return; \n        }\n    }\n\n    console.debug('Running tool:', toolId, 'with typed params:', typedParams);","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/static/js/runTool.js#L45-L81","documentation":"When converting an \"arrayValue\", each element is recursively converted via JSONToFirestoreValue. If any element fails, its error is wrapped as \"array item %d: %w\" with the failing index. This is a wrapper error — fix the underlying cause reported after the colon.","triggerScenarios":"Passing {\"arrayValue\": {\"values\": [...]}} where any element is itself invalid, e.g. a bad timestampValue or malformed mapValue inside the array.","commonSituations":"Arrays of mixed-type documents where one nested element has a mistyped timestamp or geopoint; large arrays where the offending index is not obvious.","solutions":["Read the wrapped inner error to identify the real problem with element at the given index.","Validate each array element individually with JSONToFirestoreValue before submitting the whole array.","Fix the element's type/format per the inner error's guidance (e.g. RFC 3339 timestamp)."],"exampleFix":"// before\n{\"arrayValue\": {\"values\": [{\"timestampValue\": \"not-a-date\"}]}}\n// after\n{\"arrayValue\": {\"values\": [{\"timestampValue\": \"2024-01-01T00:00:00Z\"}]}}","handlingStrategy":"try-catch","validationCode":"for i, item := range values {\n    if _, err := JSONToFirestoreValue(item, client); err != nil { return fmt.Errorf(\"array item %d invalid: %w\", i, err) }\n}","typeGuard":null,"tryCatchPattern":"if _, err := JSONToFirestoreValue(arrVal, client); err != nil {\n    var idx int\n    if n, _ := fmt.Sscanf(err.Error(), \"array item %d\", &idx); n == 1 { /* inspect element idx */ }\n}","preventionTips":["Validate each array element independently before submitting the array","Keep array elements homogeneous in type","Log the failing index from the error message"],"tags":["firestore","array","error-wrapping"],"backgroundTag":"nested-value-conversion-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}