-
Notifications
You must be signed in to change notification settings - Fork 1
routine create fails to parse API response after accepting valid folder_id #2
Copy link
Copy link
Open
asabirov/hevycli
#1Description
Environment
- hevycli installed via Homebrew cask on macOS
- Command run from terminal
- API key configured and other commands work
Problem
hevycli routine create appears to accept a valid folder_id, but then fails with a response parsing error:
error: failed to create routine: NETWORK_ERROR: failed to create routine: json: cannot unmarshal array into Go struct field RoutineResponse.routine of type api.Routine
Observed behavior
-
If
folder_idis omitted or null, the API returns:[public-post-routine] Invalid routine folder id: undefined -
If an invalid folder ID like
1is provided, the API returns:[public-post-routine] Invalid routine folder id: 1 -
If a valid folder ID is provided, the request gets past folder validation, but
hevyclicrashes parsing the response with:json: cannot unmarshal array into Go struct field RoutineResponse.routine of type api.Routine
This suggests:
- request payload is accepted
- response schema from API may now return an array where hevycli expects a single object
- or the client is decoding the wrong shape for the create response
Reproduction
Command:
hevycli -o plain routine create --file chest-next-workout.jsonExample payload:
{
"routine": {
"title": "Next Chest Workout",
"folder_id": 2607603,
"notes": "Chest hypertrophy focus. Minimum standard: log the full session and beat at least one metric next time.",
"exercises": [
{
"exercise_template_id": "79D0BB3A",
"rest_seconds": 150,
"notes": "2 warm-up sets, then 3 work sets. Leave 1-2 reps in reserve on the first two work sets.",
"sets": [
{"type": "warmup", "reps": 15},
{"type": "warmup", "reps": 8},
{"type": "normal", "reps": 10},
{"type": "normal", "reps": 8},
{"type": "normal", "reps": 6}
]
},
{
"exercise_template_id": "07B38369",
"rest_seconds": 90,
"notes": "Controlled eccentric. Full range.",
"sets": [
{"type": "normal", "reps": 12},
{"type": "normal", "reps": 10},
{"type": "normal", "reps": 8}
]
},
{
"exercise_template_id": "78683336",
"rest_seconds": 75,
"notes": "Stretch and squeeze. No sloppy reps.",
"sets": [
{"type": "normal", "reps": 15},
{"type": "normal", "reps": 12},
{"type": "normal", "reps": 12}
]
},
{
"exercise_template_id": "392887AA",
"rest_seconds": 60,
"notes": "Take sets close to failure with clean form.",
"sets": [
{"type": "normal", "reps": 15},
{"type": "normal", "reps": 12}
]
}
]
}
}Expected behavior
- Routine should be created successfully
- CLI should print created routine details or at least succeed silently
Actual behavior
- CLI returns a Go JSON unmarshal error after the request is accepted
Possible root cause
The API response shape for create may be returning:
routine: []- or another array/object layout that no longer matches the client struct:
RoutineResponse.routine api.Routine
Suggested fix
- inspect raw response body for
routine create - update the response struct to match current API behavior
- ideally add a fallback parser for object/array compatibility
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels