Describe the bug
I was going through the codebase and noticed that create_score catches a pydantic.ValidationError inside the broad except Exception block when name or value is None. The error gets logged internally but the function still returns None, so the caller has no way to detect the failure programmatically.
Steps to reproduce
import os, logging
os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-test"
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-test"
os.environ["LANGFUSE_HOST"] = "http://localhost:19999"
from langfuse import Langfuse
lf = Langfuse()
result = lf.create_score(name="accuracy", value=None, trace_id="some-trace-id")
print(result) # None, score silently dropped, no exception raised
The ValidationError does appear in langfuse logs at ERROR level, but if logs are routed away or suppressed (which is common in production), this is completely invisible to the caller.
Expected behavior
A ValueError should be raised at the call site when name or value is None. Network failures make sense to swallow since a server being down is expected, but passing the wrong type for a required field is a programmer mistake and should fail loudly. Other observability SDKs raise on this kind of thing rather than swallowing it.
I have a fix ready if this looks good.
Describe the bug
I was going through the codebase and noticed that
create_scorecatches apydantic.ValidationErrorinside the broadexcept Exceptionblock whennameorvalueisNone. The error gets logged internally but the function still returnsNone, so the caller has no way to detect the failure programmatically.Steps to reproduce
The ValidationError does appear in langfuse logs at ERROR level, but if logs are routed away or suppressed (which is common in production), this is completely invisible to the caller.
Expected behavior
A
ValueErrorshould be raised at the call site whennameorvalueisNone. Network failures make sense to swallow since a server being down is expected, but passing the wrong type for a required field is a programmer mistake and should fail loudly. Other observability SDKs raise on this kind of thing rather than swallowing it.I have a fix ready if this looks good.