Skip to content

Bug: Adding variables breaks file fetching (github:// protocol) #183

Closed

Description

@uroja97

Summary

Adding a variables section to a structure definition breaks file fetching, specifically with github:// protocol. The error is 'list' object is not a mapping.

Reproduction Steps

Case 1: Works fine (no variables)

description: "Worker Python asynchrone avec composition (project/python)."

files:
  - .gitignore:
      file: github://github/gitignore/main/Python.gitignore

✅ Generates correctly

Case 2: Breaks (with variables)

description: "Worker Python asynchrone avec composition (project/python)."

variables:
  - project_name:
      description: "Name of your project"
      type: string
      default: "MyProject"

files:
  - .gitignore:
      file: github://github/gitignore/main/Python.gitignore

❌ Error: Failed to fetch content from github://github/gitignore/main/Python.gitignore: 'list' object is not a mapping

Expected Behavior

  • Variables and file fetching should work together
  • The .gitignore file should be fetched from GitHub

Actual Behavior

  • Adding variables section causes file fetch to fail
  • Error message: 'list' object is not a mapping

Root Cause Analysis

The error 'list' object is not a mapping suggests:

  • When parsing variables (which is a list: variables: [...]), something in the file fetching logic expects a dictionary
  • The file content fetching is somehow processing the variables list instead of the file definition
  • This could be a YAML parsing issue or an ordering bug in how files and variables are processed

Possible Fix Areas

  • structkit/content_fetcher.py - verify it handles the full config structure correctly
  • structkit/template_renderer.py - check variable resolution doesn't interfere with file fetching
  • structkit/file_item.py - ensure file items are parsed correctly when variables are present
  • structkit/commands/generate.py - check config loading/processing order

Environment

  • StructKit version: 3.2.1
  • Python version: 3.x
  • OS: Linux (container)

Activity

  1. httpdss commented on Jul 21, 2026

    @httpdss
    Owner

    Thanks so much for the clear report and excellent reproduction details, @uroja97 — the side-by-side examples made this quick to trace and fix. Really appreciate you taking the time to document the expected behavior, actual error, and possible areas to inspect. 🙏

  2. self-assigned this
    on Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions