paperclipai/paperclip · error

Environment variable

Error message

Environment variable ${opts.valueEnv} is empty or unset.

What it means

--value-env named an environment variable whose value is unset or empty, so the secret value cannot be read from it.

Solutions

  1. Export the named environment variable with the secret value, or use --value.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/client/secrets.ts:200 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/f75313c3251c96c7. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/client/secrets.ts:200

      secretId,
      version: "latest",
    };
  }
  return next;
}

function asRecord(value: unknown): Record<string, unknown> | null {
  if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
  return value as Record<string, unknown>;
}

function readValueFromOptions(opts: { value?: string; valueEnv?: string }): string {
  if (opts.value !== undefined && opts.valueEnv !== undefined) {
    throw new Error("Use only one of --value or --value-env.");
  }
  if (opts.valueEnv !== undefined) {
    const value = process.env[opts.valueEnv];
    if (!value) throw new Error(`Environment variable ${opts.valueEnv} is empty or unset.`);
    return value;
  }
  if (opts.value !== undefined) return opts.value;
  throw new Error("Secret value is required. Pass --value or --value-env.");
}

function renderDeclaration(input: CompanyPortabilityEnvInput): Record<string, unknown> {
  const scope = input.agentSlug
    ? `agent:${input.agentSlug}`
    : input.projectSlug
      ? `project:${input.projectSlug}`
      : "company";
  return {
    key: input.key,
    scope,
    kind: input.kind,
    requirement: input.requirement,
    portability: input.portability,

View on GitHub (pinned to 120ae5428f)