App.yml Error after Installing Plugin

AI-generated summary

SpaceMonkey encountered a YAML parsing error after installing a plugin: unknown did not find expected key while parsing a block mapping at line 10 column 1. Falco suggested linting the file using yamllint, which revealed multiple formatting issues including missing spaces in comments and lines exceeding 80 characters. SpaceMonkey shared the full app.yml, and Falco identified the root cause: a syntax error at line 99 where two spaces preceded run, violating YAML indentation rules. The error was not related to the plugin installation itself but to improper YAML structure. Fixing the indentation at line 99 resolved the issue. The discussion highlights the sensitivity of YAML syntax and the importance of validation tools like yamllint for debugging configuration files in self-hosted Discourse setups.

I tried installing a new plugin and ran into this error after trying to rebuild app.yml. I am looking at the file but am unable to identify what the error is. I have removed the added .git from the file and the error still persists.

uknown did not find expected key while parsing a block mapping at line 10 column 1 -e LANG=en_US.UTF-8

Try linting the file:

sudo apt-get install yamllint
yamllint /var/discourse/containers/app.yml

I see a lot here. Nothing referring to the error I am getting on restart. There are quit a few entries for

missing starting space in comment

and

line too long (85 > 80 characters)

Nothing special in the line 10? Can you share the yaml (clean passwords)?

I am on a web console I will have to post later, when I can pull the full file.

My app.yml

## this is the all-in-one, standalone Discourse Docker container template                                    
##                                                                                                           
## After making changes to this file, you MUST rebuild                                                       
## /var/discourse/launcher rebuild app                                                                       
##                                                                                                           
## BE *VERY* CAREFUL WHEN EDITING!                                                                           
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!                              
## visit http://www.yamllint.com/ to validate this file as needed                                            
                                                                                                             
templates:                                                                                                   
  - "templates/postgres.template.yml"                                                                        
  - "templates/redis.template.yml"                                                                           
  - "templates/web.template.yml"                                                                             
  - "templates/web.ratelimited.template.yml"                                                                 
## Uncomment these two lines if you wish to add Lets Encrypt (https)                                         
  #- "templates/web.ssl.template.yml"                                                                        
  #- "templates/web.letsencrypt.ssl.template.yml"                                                            
                                                                                                             
                                                                                                             
## If you want Discourse to share a port with another webserver like Apache or nginx,                        
## see https://meta.discourse.org/t/17247 for details                                                        
expose:                                                                                                      
  - "80:80"   # http                                                                                         
  - "443:443" # https                                                                                        
                                                                                                             
params:                                                                                                      
  db_default_text_search_config: "pg_catalog.english"                                                        
                                                                                                             
  ## Set db_shared_buffers to a max of 25% of the total memory.                                              
  ## will be set automatically by bootstrap based on detected RAM, or you can override                       
  db_shared_buffers: "128MB"                                                                                 
                                                                                                             
  ## can improve sorting performance, but adds memory usage per-connection                                   
  #db_work_mem: "40MB"                                                                                       
                                                                                                             
  ## Which Git revision should this container use? (default: tests-passed)                                   
  #version: tests-passed                                                                                     
                                                                                                             
                                                                                                             
env:                                                                                                         
  LANG: en_US.UTF-8                                                                                          
  # DISCOURSE_DEFAULT_LOCALE: en                                                                             
                                                                                                             
  ## How many concurrent web requests are supported? Depends on memory and CPU cores.                        
  ## will be set automatically by bootstrap based on detected CPUs, or you can override                      
  UNICORN_WORKERS: 2                                                                                         
                                                                                                             
  ## TODO: The domain name this Discourse instance will respond to                                           
  ## Required. Discourse will not work with a bare IP number.                                                
  DISCOURSE_HOSTNAME: alt-manac.com                                                                          
                                                                                                             
  ## Uncomment if you want the container to be started with the same                                         
  ## hostname (-h option) as specified above (default "$hostname-$config")                                   
  #DOCKER_USE_HOSTNAME: true                                                                                 
                                                                                                             
  ## TODO: List of comma delimited emails that will be made admin and developer                              
  ## on initial signup example 'user1@example.com,user2@example.com'                                         
  DISCOURSE_DEVELOPER_EMAILS: 'mrtomruh@gmail.com'                                                           
                                                                                                             
  ## TODO: The SMTP mail server used to validate new accounts and send notifications                         
  # SMTP ADDRESS, username, and password are required                                                        
  # WARNING the char '#' in SMTP password can cause problems!                                                
  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org                                                                   
  DISCOURSE_SMTP_PORT: 587                                                                                   
  DISCOURSE_SMTP_USER_NAME: postmaster@alt-manac.com                                                         
  DISCOURSE_SMTP_PASSWORD: "+++++++++++++++++++++++++++"                              
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)                                
                                                                                                             
  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate                   
  #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com                                                                 
                                                                                                             
  ## The CDN address for this Discourse instance (configured to pull)                                        
  ## see https://meta.discourse.org/t/14857 for details                                                      
  #DISCOURSE_CDN_URL: //discourse-cdn.example.com                                                            
                                                                                                             
## The Docker container is stateless; all data is stored in /shared                                          
volumes:                                                                                                     
  - volume:                                                                                                  
      host: /var/discourse/shared/standalone                                                                 
      guest: /shared                                                                                         
  - volume:                                                                                                  
      host: /var/discourse/shared/standalone/log/var-log                                                     
      guest: /var/log                                                                                        
                                                                                                             
## Plugins go here                                                                                           
## see https://meta.discourse.org/t/19157 for details                                                        
hooks:                                                                                                       
  after_code:                                                                                                
    - exec:                                                                                                  
        cd: $home/plugins                                                                                    
        cmd:                                                                                                 
          - git clone https://github.com/discourse/docker_manager.git                                        
          - git clone https://github.com/angusmcleod/discourse-topic-previews.git                            
          - git clone https://github.com/angusmcleod/discourse-layouts.git                                   
          - git clone https://github.com/discourse/discourse-spoiler-alert.git                               
          - git clone https://github.com/pmusaraj/discourse-sidebar-blocks.git                               
                                                                                                             
## Any custom commands to run after building                                                                 
 run:                                                                                                        
  - exec: echo "Beginning of custom commands"                                                                
  ## If you want to set the 'From' email address for your first registration, uncomment and change:          
  ## After getting the first signup email, re-comment the line. It only needs to run once.                   
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"                        
  - exec: echo "End of custom commands"

yamllint output

  2:2       warning  missing starting space in comment  (comments)
  3:2       warning  missing starting space in comment  (comments)
  4:2       warning  missing starting space in comment  (comments)
  5:2       warning  missing starting space in comment  (comments)
  6:2       warning  missing starting space in comment  (comments)
                                                                                                             
  7:2       warning  missing starting space in comment  (comments)
  8:2       warning  missing starting space in comment  (comments)
  10:1      warning  missing document start "---"  (document-start)
  15:2      warning  missing starting space in comment  (comments)
  17:4      warning  missing starting space in comment  (comments)
  19:2      warning  missing starting space in comment  (comments)
  20:2      warning  missing starting space in comment  (comments)
  21:2      warning  missing starting space in comment  (comments)
  20:81     error    line too long (85 > 80 characters)  (line-length)
                                                                                                             
  16:3      warning  comment not indented like content  (comments-indentation)
  17:3      warning  comment not indented like content  (comments-indentation)
  24:15     warning  too few spaces before comment  (comments)
  29:4      warning  missing starting space in comment  (comments)
  30:81     error    line too long (86 > 80 characters)  (line-length)
  33:4      warning  missing starting space in comment  (comments)
  34:4      warning  missing starting space in comment  (comments)
  36:4      warning  missing starting space in comment  (comments)
  37:4      warning  missing starting space in comment  (comments)
  44:4      warning  missing starting space in comment  (comments)
                                                                                                             
  45:4      warning  missing starting space in comment  (comments)
  44:81     error    line too long (85 > 80 characters)  (line-length)
  45:81     error    line too long (87 > 80 characters)  (line-length)
  49:4      warning  missing starting space in comment  (comments)
  52:4      warning  missing starting space in comment  (comments)
  53:4      warning  missing starting space in comment  (comments)
  54:4      warning  missing starting space in comment  (comments)
  56:4      warning  missing starting space in comment  (comments)
  57:4      warning  missing starting space in comment  (comments)
  60:4      warning  missing starting space in comment  (comments)
                                                                                                             
  60:81     error    line too long (84 > 80 characters)  (line-length)
  67:4      warning  missing starting space in comment  (comments)
  70:4      warning  missing starting space in comment  (comments)
  72:4      warning  missing starting space in comment  (comments)
  73:4      warning  missing starting space in comment  (comments)
  74:4      warning  missing starting space in comment  (comments)
  76:2      warning  missing starting space in comment  (comments)
  69:81     error    line too long (90 > 80 characters)  (line-length)
  85:2      warning  missing starting space in comment  (comments)
                                                                                                             
  86:2      warning  missing starting space in comment  (comments)
  93:81     error    line too long (81 > 80 characters)  (line-length)
  98:1      warning  comment not indented like content  (comments-indentation)
  99:2      error    syntax error: expected <block end>, but found '<block mapping start>'
  100:3     error    wrong indentation: expected 3 but found 2  (indentation)
  101:4     warning  missing starting space in comment  (comments)
  102:4     warning  missing starting space in comment  (comments)
  103:4     warning  missing starting space in comment  (comments)
  101:81    error    line too long (99 > 80 characters)  (line-length)
  102:81    error    line too long (90 > 80 characters)  (line-length)
                                                                                                             
  103:81    error    line too long (85 > 80 characters)  (line-length)

There it is. You have two spaces before run in the line 99.