{"record":{"id":"821249fa9c902489","repo":"n8n-io/n8n","slug":"langsmith-mode-requires-dataset-to-be-a-dataset-na","errorCode":null,"errorMessage":"LangSmith mode requires dataset to be a dataset name string","messagePattern":"LangSmith mode requires dataset to be a dataset name string","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/evaluations/harness/runner.ts","lineNumber":1591,"sourceCode":"\t\t\t\tfeedback,\n\t\t\t\tdurationMs: totalDurationMs,\n\t\t\t\tgenerationDurationMs: genDurationMs,\n\t\t\t\tworkflow,\n\t\t\t\terror: errorMessage,\n\t\t\t};\n\n\t\t\tartifactSaver?.saveExample(result);\n\t\t\tcapturedResults.push(result);\n\t\t\tlifecycle?.onExampleComplete?.(index, result);\n\n\t\t\treturn { workflow, prompt, feedback };\n\t\t}\n\t};\n\n\tconst feedbackExtractor = createLangsmithFeedbackExtractor();\n\n\tif (typeof dataset !== 'string') {\n\t\tthrow new Error('LangSmith mode requires dataset to be a dataset name string');\n\t}\n\n\tconst data = await resolveAndEnrichLangsmithData({ dataset, langsmithOptions, lsClient, logger });\n\n\tconst effectiveData = applyRepetitions(data, langsmithOptions.repetitions);\n\n\ttotalExamples = Array.isArray(effectiveData) ? effectiveData.length : 0;\n\n\tlogLangsmithInputsSummary(logger, effectiveData);\n\tconst { experimentName, experimentId, datasetId } = await runLangsmithEvaluateAndFlush({\n\t\ttarget,\n\t\teffectiveData,\n\t\tfeedbackExtractor,\n\t\tlangsmithOptions,\n\t\tlsClient,\n\t\tlogger,\n\t\ttargetCallCount: () => targetCallCount,\n\t});","sourceCodeStart":1573,"sourceCodeEnd":1609,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/evaluations/harness/runner.ts#L1573-L1609","documentation":"The LangSmith runner expects `dataset` to be the dataset NAME (a string) so it can call `readDataset({datasetName})`. If a non-string is passed (object, number, array), the runner refuses to proceed because the underlying API call would fail with an opaque error. This is a defensive type check at the boundary of the LangSmith execution path.","triggerScenarios":"Programmatic callers passing the dataset object directly (`{id: '...'} ` or the resolved dataset) instead of its name, or a config builder that spreads an object into the field. The `typeof dataset !== 'string'` guard trips.","commonSituations":"Refactor that changed the `dataset` parameter from a name to an object without updating call sites; misuse from a wrapper script; a default-config object leaking into the field.","solutions":["Pass the dataset NAME string: `runLangsmithEvaluation({ dataset: 'my-dataset', ... })`.","If you only have the dataset object/id, resolve its name first and pass that.","Type the parameter at the call site as `dataset: string` so the misuse is caught at compile time."],"exampleFix":"// before\nrunLangsmithEvaluation({ dataset: { name: 'my-dataset' }, ... });\n// after\nrunLangsmithEvaluation({ dataset: 'my-dataset', ... });","handlingStrategy":"type-guard","validationCode":"function assertDatasetName(dataset: unknown): asserts dataset is string {\n  if (typeof dataset !== 'string' || dataset.length === 0) {\n    throw new Error('dataset must be a non-empty dataset-name string');\n  }\n}\nassertDatasetName(options.dataset);","typeGuard":"function isDatasetName(v: unknown): v is string {\n  return typeof v === 'string' && v.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Type the option as `dataset: string` at every call site so misuses are compile errors.","If you carry dataset objects around, resolve the name at the boundary and pass only the string downstream.","Add a unit test that passes an object and asserts the type guard rejects it."],"tags":["langsmith","dataset","types","validation"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}