theonedev/onedev · warning · ExplicitException

CI/CD spec is not being edited currently

Error message

CI/CD spec is not being edited currently

What it means

The BuildSpecBlobEditPanel exposes an MCP-like AI tool (execute) that reads/updates the CI/CD spec being edited. If the tool is invoked when no build spec content is currently in an editing session (no editing content registered), an ExplicitException 'CI/CD spec is not being edited currently' is thrown.

Source

Thrown at server-core/src/main/java/io/onedev/server/web/page/project/blob/render/renderers/buildspec/BuildSpecBlobEditPanel.java:181

						try {
							buildSpec = BuildSpec.parse(buildSpecString.getBytes(StandardCharsets.UTF_8));
						} catch (Throwable t) {					
							return completedFuture(new ToolExecutionResult(convertToJson(Map.of("successful", false, "failReason", "Malformed CI/CD spec, please fix and save again")), false));
						}

						var violations = validator.validate(buildSpec);
						Map<String, Object> resultData;
						if (!violations.isEmpty()) {
							var errorMessage = "Failed to validate CI/CD spec, please fix errors below and save again:\n\n" + 
									Joiner.on("\n").join(violations.stream().map(it -> String.format("\t-> Location: %s, Error: %s", it.getPropertyPath(), it.getMessage())).collect(Collectors.toList()));
							resultData = Map.of( "successful", false, "failReason", errorMessage);
						} else {
							updateEditingContent(handler, buildSpecString.getBytes(StandardCharsets.UTF_8));
							resultData = Map.of("successful", true);
						}
						return completedFuture(new ToolExecutionResult(convertToJson(resultData), false));
					} else {
						throw new ExplicitException("CI/CD spec is not being edited currently");
					}
				}	

			});			
		}
		return tools;
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Open the CI/CD spec file in the blob editor to start an editing session, then retry the tool call
  2. Re-run the assistant action from within the active build-spec edit panel
  3. Check that the previous editing session wasn't saved or cancelled before invoking the tool

Example fix

// before: agent calls getBuildSpecEditingContent with no spec open
// after: user opens .onedev-buildspec in editor, then agent calls the tool
Defensive patterns

Strategy: validation

Validate before calling

if (!buildSpecEditPanel.isEditingSessionActive()) {
    openBuildSpecInEditor(); // initialize editing content first
}

Try / catch

try {
    result = tool.execute();
} catch (ExplicitException e) {
    promptUserToOpenBuildSpec();
}

Prevention

When it happens

Trigger: Invoking the AI assistant's CI/CD spec tool (get/update editing content) when the blob editor has no build spec open or the editing content was never initialized via updateEditingContent.

Common situations: AI agent calling the spec tool before the user opens the .onedev-buildspec file in the editor, or after the edit session was discarded/closed.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/72174817a71adf45. Report an issue: GitHub.