Skip to content

astro dev object export panics with 'index out of range' on Airflow 3 #2082

@jlaneve

Description

@jlaneve

Description

astro dev object export crashes with a runtime panic when the project is running Airflow 3.

Reproduction

  1. Create a new Astro project with an Airflow 3 runtime (e.g., astro dev init --runtime-version 3.1-12)
  2. Run astro dev start
  3. Run astro dev object export

Expected

The command exports connections, variables, and pools from the running Airflow instance to a YAML settings file.

Actual

The command panics:

Exporting Pool: default_pool
successfully exported pools

successfully exported variables

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/astronomer/astro-cli/settings.ExportConnections({0x...})
	settings/settings.go:574 +0x768

Root cause

settings.ExportConnections (in settings/settings.go) runs airflow connections list -o yaml inside the container and then parses the output by splitting on the literal string "- conn_id:":

yamlCons := "- conn_id:" + strings.SplitN(plainOut, "- conn_id:", 2)[1]

In Airflow 3, the airflow connections list -o yaml output format has changed and no longer contains "- conn_id:", so strings.SplitN returns a slice of length 1 and indexing [1] panics.

Pools and variables export correctly because they use different code paths.

Suggested fix

Either:

  1. Switch ExportConnections / ExportVariables / ExportPools to use the Airflow REST API (similar to Batch import Airflow settings to speed up dev start #2078), or
  2. Parse the new Airflow 3 YAML format (and handle both v2 and v3 formats), or
  3. At minimum, guard the slice access so it returns a clear error instead of panicking

Note: this is unrelated to #2078 (settings import via REST API). That PR only fixes the import path; the export path still uses the old CLI-based approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions