Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: Panic when removing resource_monitoring block from coder_agent resource #432

Closed
Assignees
mtojek
@blink-so

Description

@blink-so

Description

Removing theresource_monitoring block from acoder_agent resource causes a panic with "index out of range [0] with length 0" error when starting workspaces. This appears to be a long-standing issue that affects workspace functionality when users attempt to disable resource monitoring.

Note: The issue occurs both when completely removing the block AND when replacing the content with empty braces{}.

Expected Behavior

  • Removing theresource_monitoring block should either:
    1. Allow the workspace to start normally without monitoring (if this is intended to be optional)
    2. Provide a clear validation error explaining thatresource_monitoring is required
  • Emptyresource_monitoring {} blocks should either be handled gracefully or validated properly

Actual Behavior

  • Workspace fails to start with a panic
  • Error message:The plugin.(*GRPCProvider).PlanResourceChange request was cancelled.
  • Stack trace shows:panic: runtime error: index out of range [0] with length 0

Steps to Reproduce

  1. Create a template with acoder_agent resource that includes aresource_monitoring block
  2. Successfully deploy workspaces using this template
  3. Either:
    • Remove the entireresource_monitoring block from thecoder_agent resource, OR
    • Replace theresource_monitoring content with empty braces:resource_monitoring {}
  4. Update the template
  5. Attempt to start a workspace

Environment

  • Provider Version: v2.10.0 (also reproduced in v2.8.0 and v2.4.0)
  • Test platform: Coder 2.25.1

Example Configuration

Working configuration:

resource"coder_agent""main" {os="linux"arch="amd64"resources_monitoring {memory {enabled=truethreshold=90    }volume {path="/home/coder"enabled=truethreshold=80    }  }}

Failing configurations:

Option 1 - Completely removed:

resource"coder_agent""main" {os="linux"arch="amd64"# resource_monitoring block removed entirely}

Option 2 - Empty block:

resource"coder_agent""main" {os="linux"arch="amd64"resources_monitoring {# empty block - also causes panic  }}

Additional Context

  • This issue has been consistent across multiple provider versions (v2.4.0, v2.8.0, v2.10.0)
  • The panic occurs at runtime when starting workspaces, not during template validation
  • Template can be uploaded successfully, but workspace creation fails
  • Rolling back the provider version does not resolve the issue once theresource_monitoring block is removed or emptied
  • The error specifically affects line 86 in the customer's template (thecoder_agent resource)
  • Both complete removal and empty block replacement ({}) are equally destructive

Customer Impact

  • Prevents users from disabling resource monitoring when desired
  • Causes workspace startup failures
  • Requires keeping resource monitoring enabled with actual content even when not needed
  • No graceful way to disable monitoring functionality

Suggested Solutions

  1. If resource_monitoring is optional: Fix the panic by properly handling the case where the block is absent or empty
  2. If resource_monitoring is required: Add proper validation to prevent template upload/update when the block is missing or empty
  3. Feature enhancement: Allow explicit disabling of resource monitoring with a boolean flag or handle empty blocks gracefully
  4. Validation improvement: Provide clear error messages during template validation rather than runtime panics

Classification

This issue sits between a bug report and feature request:

  • Bug aspect: The panic and poor error handling when the block is removed or emptied
  • Feature aspect: The ability to optionally disable resource monitoring

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp