{"record":{"id":"93b979d78b26de20","repo":"cube-js/cube","slug":"no-dbt-sync-sync-job-id-on-deployment-deploymen-93b979","errorCode":null,"errorMessage":"no dbt sync {sync_job_id} on deployment {deployment} (it may not be visible yet, belong to another deployment, or have aged out)","messagePattern":"no dbt sync (.+?) on deployment (.+?) \\(it may not be visible yet, belong to another deployment, or have aged out\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cube-cli/src/commands/dbt.rs","lineNumber":449,"sourceCode":"                        util::one_line(&output::field(&status, \"error\"), util::REASON_LIMIT);\n                    bail!(\n                        \"dbt sync {sync_job_id} failed: {}\",\n                        if util::is_blank(&error) {\n                            \"(no reason reported)\".to_string()\n                        } else {\n                            error\n                        }\n                    );\n                }\n\n                return Ok(());\n            }\n\n            let query: Query = Vec::new();\n            let path = format!(\"{}/{sync_job_id}\", base(deployment));\n            match api.get_optional(&path, &query).await? {\n                Some(status) => print_status(ctx.json, &status),\n                None => bail!(\n                    \"no dbt sync {sync_job_id} on deployment {deployment} \\\n                     (it may not be visible yet, belong to another deployment, or have aged out)\"\n                ),\n            }\n        }\n        Cmd::Result {\n            deployment,\n            sync_job_id,\n        } => {\n            let path = format!(\"{}/{sync_job_id}/result\", base(deployment));\n            match available_result(api.get_optional(&path, &Vec::new()).await?) {\n                Some(result) => print_result(ctx.json, &result),\n                // A running sync, `200 null`, and `{}` all mean \"not available yet\".\n                None => bail!(\n                    \"no result for dbt sync {sync_job_id} yet — check \\\n                     `cube dbt status {deployment} {}`\",\n                    util::shell_quote(&sync_job_id)\n                ),","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cube-cli/src/commands/dbt.rs#L431-L467","documentation":"Raised by `cube dbt status <deployment> <sync_job_id>` (without --wait) when the status endpoint returns 404/None for the job. The CLI cannot find that sync job on the given deployment — it may not be registered yet, may belong to another deployment, or may have aged out of retention.","triggerScenarios":"A single GET of /deployments/<deployment>/.../<sync_job_id> returns None: querying immediately after POST /sync before the job is visible, wrong deployment number, wrong/typo'd job ID, or a job past retention.","commonSituations":"Scripting that reads the sync status a split second after starting the sync; copying a syncJobId from logs of a different environment; checking a sync from days ago that the backend purged.","solutions":["If the sync was started moments ago, wait a beat and retry the status command.","Re-check the sync_job_id against the output of the sync command that created it.","Confirm the deployment argument matches the deployment that owns the sync.","If the job is old, assume it aged out and start a new sync."],"exampleFix":"// before: status immediately after start\nlet started = api.post(&base, Some(&body)).await?;\nlet status = api.get_optional(&format!(\"{base}/{id}\"), &query).await?; // may 404\n// after: retry with backoff before concluding the job is missing\nlet status = wait::poll(Wait::new(\"dbt sync\", timeout, interval), || async {\n    match api.get_optional(&path, &query).await? {\n        Some(s) => Ok(Progress::Done(s)),\n        None => Ok(Progress::Waiting(\"not visible yet\".into())),\n    }\n}).await?;","handlingStrategy":"retry","validationCode":"// Verify job visibility once before treating absence as fatal\nif api.get_optional(&format!(\"{base}/{id}\"), &query).await?.is_none() {\n    eprintln!(\"sync {id} not visible yet; will retry\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"no dbt sync\") => {\n        tokio::time::sleep(grace).await; // short retry in case registration lagged\n    }\n    other => other?,\n}","preventionTips":["Insert a brief delay/retry between starting a sync and first reading its status.","Pass the deployment explicitly and validate it in scripts.","Copy syncJobId values programmatically from command output, not by hand.","Assume retention purges old jobs; never index long-term state by sync_job_id."],"tags":["cli","dbt","http-404","resource-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}