From cbf52289502e049dff0986ac511a4cedb0129b51 Mon Sep 17 00:00:00 2001 From: tengxiaoliu Date: Mon, 15 Jun 2026 20:40:43 +0000 Subject: [PATCH] fix(cli): execute crashes with 'str' object has no attribute 'get' instances_api.execute() polls the result URL internally and returns the command output as a str on success (or the raw response dict on failure). The CLI execute() handler still assumed the old dict shape and called rj.get("success"), raising AttributeError: 'str' object has no attribute 'get' on every successful 'vastai execute' invocation. The dict-based polling loop here is now dead code (the API layer already polled), so just print the returned value. --- vastai/cli/commands/misc.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/vastai/cli/commands/misc.py b/vastai/cli/commands/misc.py index 9ca0896f..c405dfcc 100644 --- a/vastai/cli/commands/misc.py +++ b/vastai/cli/commands/misc.py @@ -77,17 +77,12 @@ def execute(args): add_scheduled_job(client, args, json_blob, cli_command, api_endpoint, "PUT", instance_id=args.id) return - if rj.get("success"): - for i in range(0, 30): - time.sleep(0.3) - url = rj["result_url"] - r2 = req_lib.get(url) - if r2.status_code == 200: - filtered_text = r2.text.replace(rj["writeable_path"], '') - print(filtered_text) - break - else: - print(rj) + # instances_api.execute() already polls the result URL internally and + # returns the command's output as a str on success, or the raw response + # dict on failure (no result_url). The previous code assumed a dict and + # called rj.get("success"), which raised + # "'str' object has no attribute 'get'" on the normal success path. + print(rj) # ---------------------------------------------------------------------------