<#1289 fix: json-raw CLI output tolerates non-seri...
# flyte-github
a
#1289 fix: json-raw CLI output tolerates non-serializable values like pathlib.Path (FLYTE-SDK-6G) Pull request opened by EngHabu Problem
flyte deploy -o json-raw
crashes with a raw
TypeError: Object of type PosixPath is not JSON serializable
(Sentry FLYTE-SDK-6G, seen on 2.3.9).
cli/_common.format
renders the
json-raw
format with a bare
json.dumps(...)
. When a deploy surfaces failed module loads, the rows are built as
[("Path", p), ("Err", e)]
(see
cli/_deploy.py:195
) where
p
is a
pathlib.Path
.
dict(v)
then yields
{"Path": PosixPath(...)}
, which stdlib
json.dumps
cannot serialize, so the exception leaks to the user (and to Sentry). Fix Pass
default=str
to
json.dumps
so any value that isn't natively JSON serializable (Path and friends) falls back to its string form instead of raising. Mirrors what the rich-based
json
branch already tolerates. Test
tests/flyte/cli/test_common_format.py
— asserts a
Path
value serializes to its string form via
json-raw
, plus the empty-list case. fixes FLYTE-SDK-6G 🤖 Generated with Claude Code flyteorg/flyte-sdk