You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

services.yml报错:未加引号的映射值中不能使用冒号

问题排查与解决方案

核心错误原因

  1. YAML缩进违规:ImportLicenceCodeService配置块内的autowire、autoconfigure、bind属性缩进层级错误——它们应当与public: true处于同一缩进层级,而非额外缩进一级。YAML对缩进规则极为严格,错误的缩进会导致解析器无法识别正确的配置结构,进而触发"未加引号的映射值中使用冒号"的误报(实际是结构解析混乱引发的连锁错误)。
  2. 潜在参数缺失:配置中用到的%config_bigQuery_prod%参数未出现在你提供的parameters.yml片段中,需确保该参数已在配置文件中定义。

修正后的services.yml代码片段

AdminBundle\Services\CustomerChangeSetService:
    public: true
    autowire: true
    autoconfigure: true
    bind:
      $googleProjectId: "%google_project_id%"
      $googlePath: "%kernel.root_dir%/../%google_token_path%"
      $googleQuery: "%google_bigquery_dataset%"
      $googleConfig: "%config_bigQuery_prod%"
      $tableName: "%google_bigquery_table_customerchangeset%"
      $bucketName: "%google_bucket_name%"

AdminBundle\Services\APILogsService:
    public: true
    autowire: true
    autoconfigure: true
    bind:
      $googleProjectId: "%google_project_id%"
      $googlePath: "%kernel.root_dir%/../%google_token_path%"
      $googleQuery: "%google_bigquery_dataset%"
      $googleConfig: "%config_bigQuery_prod%"
      $tableName: "%google_bigquery_table_apilogs%"
      $bucketName: "%google_bucket_name%"

AdminBundle\Services\ImportLicenceCodeService:
    public: true
    autowire: true
    autoconfigure: true
    bind:
      $googleProjectId: "%google_project_id%"
      $googlePath: "%kernel.root_dir%/../%google_token_path%"
      $googleQuery: "%google_bigquery_dataset%"
      $googleConfig: "%config_bigQuery_prod%"
      $tableName: "%google_bigquery_table_importlicencecode%"
      $bucketName: "%google_bucket_name%"

额外检查项

  • 补充parameters.yml中缺失的config_bigQuery_prod参数,示例:
    config_bigQuery_prod: "your_production_config_value"
    
  • 验证%kernel.root_dir%/../%google_token_path%拼接后的实际路径是否正确,确保目标文件存在且Symfony服务拥有读取权限。

内容的提问来源于stack exchange,提问作者Borloo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 09:20:30