> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voxworks.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate, Compile and Publish

> How a survey becomes a runnable call script: the Validate, Compile and Publish buttons, who can use them, the job labels while they run, script version numbers, how compiled drafts relate to test calls and live calls, and what to do when a compile or publish fails.

## From survey to call script

A survey does not make calls by itself. Voxworks **compiles** it into an ordinary Call Script, with a flow for the survey and a flow for each question. That script is what places and answers calls — see [Running a survey](/surveys/running-a-survey).

Nothing compiles automatically. Saving a question or a section never changes the compiled script; only these three buttons do:

| Button       | Where                                     | What it does                                                                                            |
| ------------ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| **Validate** | Workspace header                          | Opens [Readiness](/surveys/readiness). On an editable draft with no blockers, it also starts a compile. |
| **Compile**  | The **Compile** card on the Readiness tab | Starts a compile of the selected version. Disabled while blockers exist or a job is running.            |
| **Publish**  | Workspace header                          | Checks readiness again, compiles, and makes this version the live one.                                  |

Compile and Publish need the `surveys.publish` permission, which team owners have and members do not (see [Surveys](/surveys/overview)). A user without it can still press **Validate** to open the readiness report.

***

## Compile: build a draft you can test

Press **Validate** or **Compile**. The compile runs in the background — you can keep working or leave the page. It usually takes 20 to 75 seconds, a little longer for large surveys, and can take a few seconds to start.

While it runs, a badge next to the survey title and the button that started it show the progress:

| Label              | Meaning                                            |
| ------------------ | -------------------------------------------------- |
| **Queued…**        | Waiting to start.                                  |
| **Compiling…**     | Building the script.                               |
| **Compiled**       | Finished. The toast reads *Compiled for voice*.    |
| **Compile failed** | See [When a compile fails](#when-a-compile-fails). |

**Validate** and **Publish** are disabled while any job for the survey is running. Pressing a button twice is safe — the second press joins the running job rather than starting another.

After a compile, the **Compile** card on the Readiness tab shows:

| Row          | Shows                                                                                     |
| ------------ | ----------------------------------------------------------------------------------------- |
| **Status**   | The last compile's result — `not compiled`, `queued`, `running`, `succeeded` or `failed`. |
| **Script**   | The compiled script's id.                                                                 |
| **Revision** | The script's version number, for example `0.3.0`.                                         |

A compiled draft becomes a **draft version** of the survey's script. Like any draft script version, it runs on [test calls](/calls/test-calls) but not on real calls once the survey has a published version — so compile, then test call the script from **Call Scripts** to hear the survey before you publish it.

***

## Publish: make it live

Press **Publish** in the header. It is shown to users with the publish permission when the version is a draft, validated or imported.

Publishing:

1. Re-runs readiness. If anything blocks, it stops with *"Publishing is blocked:"* followed by the first blocker.
2. Freezes the version — its status moves from `draft` through `validating` and `validated` to `publishing`.
3. Compiles it as a new **live** version of the script. The header shows **Publishing…**.
4. On success, the version becomes `published` and the previously published version becomes `retired`. The toast reads *Survey version published*.

Real calls — batches, inbound numbers, **New Call** — always run the most recently published version. A published version can no longer be edited; to change it, create a new draft from [Version history](/surveys/versions).

If you press **Publish** while a publish is already running: *"This version is already being published. Its result will appear when it finishes."*

***

## Script version numbers

The compiled script's version number follows the same pattern as any script (see [Script Versions & Publishing](/scripts/versions-and-publishing)):

| Action                                 | Version change                 | Example           |
| -------------------------------------- | ------------------------------ | ----------------- |
| First compile of a survey              | Creates the script at `0.1.0`  | `0.1.0`           |
| Each later **Compile** or **Validate** | Moves the middle number        | `0.1.0` → `0.2.0` |
| **Publish**                            | Moves to the next whole number | `0.4.0` → `1.0.0` |
| Compiles after publishing              | Moves the middle number again  | `1.0.0` → `1.1.0` |

Every compile moves the number, even if nothing changed. A failed publish uses up no number — the retry lands on the same one.

The script and its flows are created on the first compile and reused by every version after it, so the survey always has one script. **Version history** shows each version's compile as *Compiled · 0.6.0* or *Published · 1.0.0*, with *×N* when it has been compiled more than once.

***

## When a compile fails

A failed compile shows **Compile failed** and a toast. The **Compile** card on the [Readiness](/surveys/readiness) tab lists each error as:

*(code) · (question key) — (message)*

| Code                             | What it means                                                                                                                                        | What to do                                            |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| Structural and build-check codes | The survey is too large or too heavily routed to build as it stands, or the built script did not pass its final checks.                              | Speak to the Voxworks team.                           |
| `compile_failed`                 | The compile stopped with an error.                                                                                                                   | Try again; if it repeats, speak to the Voxworks team. |
| `worker_lost`                    | *"The process running this compile stopped reporting more than 15 minutes ago and was declared lost. Nothing was published. Run the compile again."* | Press **Compile** or **Publish** again.               |

To retry, press the button again. Each attempt is a new job on the [Jobs](/surveys/jobs) page.

### When a publish fails

A failed publish shows **Publish failed** and a toast — usually *"The publish failed — nothing was published. See Readiness."* The version goes back to `validated` (or `imported`), and **the version that was live stays live** — callers are unaffected. Code `publish_failed` means *"The compiled package could not be written: (reason)"*. Fix what the errors describe, or try again.

***

## A typical cycle

1. Write or change questions on a draft.
2. Press **Validate**. Fix any blockers on the Readiness tab, and read the warnings.
3. When it compiles, open the script from **Settings → Compiled identity → Script** and place a [test call](/calls/test-calls).
4. Adjust, validate and test again until it sounds right.
5. Press **Publish**.
6. Run it from a batch or an inbound number — see [Running a survey](/surveys/running-a-survey).
