[Bug] LangSmith integration fails with invalid dotted_order timestamp format #21221

Closed
opened 2026-02-21 20:11:29 -05:00 by yindo · 1 comment
Owner

Originally created by @ericko-being on GitHub (Dec 23, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Configure LangSmith integration in Dify (Settings > Monitoring > LangSmith)
  2. Run any workflow or chat that triggers tracing
  3. Check docker-worker logs: docker logs docker-worker-1

✔️ Expected Behavior

Traces should be successfully sent to LangSmith dashboard.

Actual Behavior

Traces fail with error:

Failed to multipart ingest runs: langsmith.utils.LangSmithError:
Failed to POST https://api.smith.langchain.com/runs/multipart in LangSmith API.
HTTPError('400 Client Error: Bad Request for url: https://api.smith.langchain.com/runs/multipart',
'{"error":"Bad request: invalid dotted_order: invalid timestamp format in dotted_order at index 0:
invalid timestamp value: parsing time 20251223T041955.111 as 20060102T150405.000000:
cannot parse .111 as .000000 for run_id:46269f8a-a440-4c67-83d8-52a4e85d9a41"}')

Root Cause

In api/core/ops/utils.py, the generate_dotted_order function truncates microseconds to 3 digits:

timestamp = start_time.strftime("%Y%m%dT%H%M%S%f")[:-3] + "Z"

LangSmith API expects 6-digit microseconds, but the [:-3] slice produces only 3 digits.

Proposed Fix

Remove the [:-3] slice:

timestamp = start_time.strftime("%Y%m%dT%H%M%S%f") + "Z"
Originally created by @ericko-being on GitHub (Dec 23, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Configure LangSmith integration in Dify (Settings > Monitoring > LangSmith) 2. Run any workflow or chat that triggers tracing 3. Check docker-worker logs: `docker logs docker-worker-1` ### ✔️ Expected Behavior Traces should be successfully sent to LangSmith dashboard. ### ❌ Actual Behavior Traces fail with error: ``` Failed to multipart ingest runs: langsmith.utils.LangSmithError: Failed to POST https://api.smith.langchain.com/runs/multipart in LangSmith API. HTTPError('400 Client Error: Bad Request for url: https://api.smith.langchain.com/runs/multipart', '{"error":"Bad request: invalid dotted_order: invalid timestamp format in dotted_order at index 0: invalid timestamp value: parsing time 20251223T041955.111 as 20060102T150405.000000: cannot parse .111 as .000000 for run_id:46269f8a-a440-4c67-83d8-52a4e85d9a41"}') ``` ### Root Cause In `api/core/ops/utils.py`, the `generate_dotted_order` function truncates microseconds to 3 digits: ```python timestamp = start_time.strftime("%Y%m%dT%H%M%S%f")[:-3] + "Z" LangSmith API expects 6-digit microseconds, but the [:-3] slice produces only 3 digits. Proposed Fix Remove the [:-3] slice: timestamp = start_time.strftime("%Y%m%dT%H%M%S%f") + "Z"
yindo added the 🐞 bug label 2026-02-21 20:11:29 -05:00
yindo closed this issue 2026-02-21 20:11:29 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 23, 2025):

Hi @ericko-being! I'm Dosu and I’m helping the dify team.

The root cause is confirmed: the generate_dotted_order function truncates microseconds to 3 digits, but LangSmith expects 6-digit microseconds in the timestamp, causing the 400 error you observed. The proposed fix—removing the [:-3] slice so the line reads timestamp = start_time.strftime("%Y%m%dT%H%M%S%f") + "Z"—will restore full microsecond precision and resolve the issue for LangSmith integration. This change is safe and aligns with LangSmith's requirements, as the truncated format is the direct cause of the API rejection. No recent updates or merged pull requests have addressed this bug, so you will need to apply the fix manually in your deployment. The dotted_order value is only used for LangSmith trace runs, so there are no known side effects elsewhere in Dify. For reference, you can review the implementation and usage in the codebase here and here.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 23, 2025): <!-- Greeting --> Hi @ericko-being! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> The root cause is confirmed: the `generate_dotted_order` function truncates microseconds to 3 digits, but LangSmith expects 6-digit microseconds in the timestamp, causing the 400 error you observed. The proposed fix—removing the `[:-3]` slice so the line reads `timestamp = start_time.strftime("%Y%m%dT%H%M%S%f") + "Z"`—will restore full microsecond precision and resolve the issue for LangSmith integration. This change is safe and aligns with LangSmith's requirements, as the truncated format is the direct cause of the API rejection. No recent updates or merged pull requests have addressed this bug, so you will need to apply the fix manually in your deployment. The dotted_order value is only used for LangSmith trace runs, so there are no known side effects elsewhere in Dify. For reference, you can review the implementation and usage in the codebase [here](https://github.com/langgenius/dify/blob/d005689d0a8bf31f0787c4c0bd1affe675713c31/api/core/ops/utils.py#L52-L63) and [here](https://github.com/langgenius/dify/blob/d005689d0a8bf31f0787c4c0bd1affe675713c31/api/core/ops/langsmith_trace/langsmith_trace.py#L70-L488). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0e4852c8-5beb-402b-848b-14f8046d4fc8?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20root%20cause%20is%20confirmed%3A%20the%20%60generate_dotted_order%60%20function%20truncates%20microseconds%20to%203%20digits%2C%20but%20LangSmith%20expects%206-digit%20microseconds%20in%20the%20timestamp%2C%20causing%20the%20400%20error%20you%20observed.%20The%20proposed%20fix%E2%80%94removing%20the%20%60%5B%3A-3%5D%60%20slice%20so%20the%20line%20reads%20%60timestamp%20%3D%20start_time.strftime%28%22%25Y%25m%25dT%25H%25M%25S%25f%22%29%20%2B%20%22Z%22%60%E2%80%94will%20restore%20full%20microsecond%20precision%20and%20resolve%20the%20issue%20for%20LangSmith%20integration.%20This%20change%20is%20safe%20and%20aligns%20with%20LangSmith%27s%20requirements%2C%20as%20the%20truncated%20format%20is%20the%20direct%20cause%20of%20the%20API%20rejection.%20No%20recent%20updates%20or%20merged%20pull%20requests%20have%20addressed%20this%20bug%2C%20so%20you%20will%20need%20to%20apply%20the%20fix%20manually%20in%20your%20deployment.%20The%20dotted_order%20value%20is%20only%20used%20for%20LangSmith%20trace%20runs%2C%20so%20there%20are%20no%20known%20side%20effects%20elsewhere%20in%20Dify.%20For%20reference%2C%20you%20can%20review%20the%20implementation%20and%20usage%20in%20the%20codebase%20%5Bhere%5D%28https%3A//github.com/langgenius/dify/blob/d005689d0a8bf31f0787c4c0bd1affe675713c31/api/core/ops/utils.py%23L52-L63%29%20and%20%5Bhere%5D%28https%3A//github.com/langgenius/dify/blob/d005689d0a8bf31f0787c4c0bd1affe675713c31/api/core/ops/langsmith_trace/langsmith_trace.py%23L70-L488%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30021)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21221