tursodatabase/turso · error · syn::Error

Unknown section

Error message

Unknown section

What it means

turso_macros' register_extension! parses its input as sections aggregates:, scalars:, vtabs:, vfs:, each followed by a braced, comma-separated identifier list. An identifier followed by a colon that is not one of these four fails compilation with "Unknown section", with the span pointing at the offending identifier.

Source

Thrown at macros/src/ext/mod.rs:163

                    let content;
                    syn::braced!(content in input);
                    let parsed_items = Punctuated::<Ident, Token![,]>::parse_terminated(&content)?
                        .into_iter()
                        .collect();

                    match section_name.to_string().as_str() {
                        "aggregates" => aggregates = parsed_items,
                        "scalars" => scalars = parsed_items,
                        "vtabs" => vtabs = parsed_items,
                        "vfs" => vfs = parsed_items,
                        _ => unreachable!(),
                    };

                    if input.peek(Token![,]) {
                        input.parse::<Token![,]>()?;
                    }
                } else {
                    return Err(syn::Error::new(section_name.span(), "Unknown section"));
                }
            } else {
                return Err(input.error("Expected aggregates:, scalars:, or vtabs: section"));
            }
        }

        Ok(Self {
            aggregates,
            scalars,
            vtabs,
            vfs,
        })
    }
}

pub(crate) struct ScalarInfo {
    pub name: String,
    pub alias: Option<String>,

View on GitHub (pinned to 244cde92a7)

Solutions

  1. Use only the four section names - plain scalar functions go under scalars:
  2. Copy the exact macro grammar from extensions/ in the turso version you depend on
  3. Update the extension crate's turso dependencies so macro and docs agree

Example fix

// before
register_extension! { functions: { rot13 } }
// after
register_extension! { scalars: { rot13 } }
Defensive patterns

Strategy: validation

Validate before calling

# CI guard: reject unknown register_extension! sections
rg -n 'register_extension!' extensions/ -A0 | rg -v '(aggregates|scalars|vtabs|vfs)' && exit 1 || true

Prevention

When it happens

Trigger: Writing functions:, udfs:, or any guessed section name in register_extension!; also using vfs: against a turso version where that section did not exist yet.

Common situations: Authoring a new extension from memory, an outdated template or docs page, or upgrading/downgrading turso where the accepted section set changed.

Related errors


AI-assisted analysis of tursodatabase/turso@244cde92a7 (2026-08-20). Data as JSON: /api/errors/640505aabad589fb. Report an issue: GitHub.