Skip to content

[Safe Outputs Conformance] USE-001: Two handlers missing standardized error codes (ERR_* prefix) #26308

@github-actions

Description

@github-actions

Conformance Check Failure

Check ID: USE-001
Severity: LOW
Category: Usability

Problem Description

Two handlers throw errors without using the standardized ERR_* prefixes defined in error_codes.cjs. Standardized error codes enable structured logging, monitoring dashboards, and alerting rules — and they are already the established pattern in other handlers (e.g., create_issue.cjs uses ERR_VALIDATION).

Affected Components

  • actions/setup/js/close_entity_helpers.cjs — line 404: throw commentError; (re-throws without wrapping in a coded error)
  • actions/setup/js/generate_safe_outputs_tools.cjs — lines 51, 60: throw new Error(msg) (no ERR_* prefix)
Current vs Expected Behavior

Current Behavior

// close_entity_helpers.cjs:404
throw commentError;

// generate_safe_outputs_tools.cjs:51, 60
throw new Error(msg);

Expected Behavior

Import the appropriate code from error_codes.cjs and prefix errors:

const { ERR_API, ERR_VALIDATION } = require("./error_codes.cjs");

// close_entity_helpers.cjs — wrap or annotate re-thrown API errors
throw new Error(`\$\{ERR_API}: \$\{commentError.message}`);

// generate_safe_outputs_tools.cjs — prefix validation/config errors
throw new Error(`\$\{ERR_VALIDATION}: \$\{msg}`);

Available codes: ERR_VALIDATION, ERR_PERMISSION, ERR_API, ERR_CONFIG, ERR_NOT_FOUND, ERR_PARSE, ERR_SYSTEM.

Remediation Steps

This task can be assigned to a Copilot coding agent with the following steps:

  1. In close_entity_helpers.cjs: identify the catch block around line 404, determine the correct error category (likely ERR_API since it's a comment API call), and wrap the re-thrown error with a coded message.
  2. In generate_safe_outputs_tools.cjs: add require("./error_codes.cjs") at the top and prefix the two throw new Error(msg) calls with the appropriate ERR_* code (likely ERR_VALIDATION or ERR_CONFIG).
  3. Ensure no test snapshots need updating after the change.

Verification

After remediation, verify the fix by running:

bash scripts/check-safe-outputs-conformance.sh

The check USE-001 should pass without errors.

References

  • Safe Outputs Specification: docs/src/content/docs/reference/safe-outputs-specification.md
  • Error codes module: actions/setup/js/error_codes.cjs
  • Conformance Checker: scripts/check-safe-outputs-conformance.sh
  • Run ID: §24425263907
  • Date: 2026-04-14

Generated by Daily Safe Outputs Conformance Checker · ● 115K ·

  • expires on Apr 15, 2026, 10:10 PM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions